From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 11 01:34:50 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 35008106564A for ; Wed, 11 Apr 2012 01:34:50 +0000 (UTC) (envelope-from sushanth_rai@yahoo.com) Received: from nm24.bullet.mail.sp2.yahoo.com (nm24.bullet.mail.sp2.yahoo.com [98.139.91.94]) by mx1.freebsd.org (Postfix) with SMTP id 091A48FC08 for ; Wed, 11 Apr 2012 01:34:50 +0000 (UTC) Received: from [98.139.91.62] by nm24.bullet.mail.sp2.yahoo.com with NNFMP; 11 Apr 2012 01:34:44 -0000 Received: from [98.139.44.71] by tm2.bullet.mail.sp2.yahoo.com with NNFMP; 11 Apr 2012 01:33:44 -0000 Received: from [127.0.0.1] by omp1008.access.mail.sp2.yahoo.com with NNFMP; 11 Apr 2012 01:33:44 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 714572.31601.bm@omp1008.access.mail.sp2.yahoo.com Received: (qmail 29028 invoked by uid 60001); 11 Apr 2012 01:33:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1334108024; bh=s/bWaMJiZJkLKqq5qrrg36W4vUzRb0Q86iSNcI/URu4=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=R25NYlpVs651SHNBYSSl0EoFCK8yI5GHyuP6pcUUem95G6tfilhlbJIFSZHNle1uU6zLW0LCvFBQ54i6gdcA2OJfeSittEU3nT2GHLvlF8AVHEae4JbXI43yZF3m4PwrMz3vT7q7GJv8KSUDRbAvEQasKfZBCqOke9lPFPi7b5A= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=j5k1ohkRiP9p2w0E6pzCrUAgVekwRO74wXQH9j6VzARZiN/Hv7iEUPNdAoE0BMSdCqGx4wWrPBdK2egZ6jJr4fqwZn8bmiYLVBFcQVYxJeFiFVCPqf387xklfQ4R7ffkSxcKWW8g+8mPh+u11dYjiuAfsgxdU/9OXieucDxUHiQ=; X-YMail-OSG: pvF.c8QVM1mytRj1ps.n29r0PMyE31XCoezExfZ7CcWKMFi _KmtZom9vCvpYho7LPtDVikuso.kIeskvFzLVEO8FRBt0RZkxQ8tvBn1Y254 7sGjRsjz96_EpV.5c9UcndiRTR_P4_h5Pjt1sDpoNBapreniHSa.dJPdFaTD g1HkN3JhIm7IWyl_0MfE6I_f.YJGdT5sujg0wXEumf2gqUrcjJDex6oxrx4d TTF09tOPudZLYugTuJTy69m5j4tVtH5lhI90eznen9gEMFZCPThFkJJGO9dY jCW.1hyB6suENNR9FvQohMdXWvNBAJBvmzirbUUUVeZGVHyyR8kd05X7.Xmf DRC.pQscbPm0zRBuDXfVm_o_DMjEuwDXN7kAin8bkcviK1dWN1wMSeqEYtFl LutT877liS3k7.LLyLUR8RGJT2u_afR1sqs0Z3ICJkUsCUBoCwOzadvNt_.J up1Xm_ho- Received: from [209.119.38.67] by web180005.mail.gq1.yahoo.com via HTTP; Tue, 10 Apr 2012 18:33:44 PDT X-Mailer: YahooMailClassic/15.0.5 YahooMailWebService/0.8.117.340979 Message-ID: <1334108024.348.YahooMailClassic@web180005.mail.gq1.yahoo.com> Date: Tue, 10 Apr 2012 18:33:44 -0700 (PDT) From: Sushanth Rai To: Konstantin Belousov In-Reply-To: <20120410095726.GU2358@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: mlockall() on freebsd 7.2 + amd64 returns EAGAIN X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2012 01:34:50 -0000 =0A> > I don't know if that has anything to do with failure.=0A> The snippe= t of code that returns failure in vm_fault() is=0A> the following:=0A> > = =0A> > if (fs.pindex >=3D fs.object->size) {=0A> >=A0 =A0=0A> =A0=A0=A0unlo= ck_and_deallocate(&fs);=0A> >=A0 =A0 =A0=A0=A0return=0A> (KERN_PROTECTION_F= AILURE);=0A> > }=0A> > =0A> > Any help would be appreciated.=0A> =0A> This = might be a bug fixed in r191810, but I am not sure.=0A> =0A=0AI tried that = fix but it didn't work. What seems to happen is that libm is mmap'ed beyond= the size of the file. From truss o/p, I see the following:=0A=0Aopen("/lib= /libm.so.5",O_RDONLY,030577200)=09 =3D 3 (0x3)=0Afstat(3,{ mode=3D-r--r--r-= - ,inode=3D918533,size=3D115560,blksize=3D4096 }) =3D 0 (0x0)=0Aread(3,"\^?= ELF\^B\^A\^A\t\0\0\0\0\0\0\0"...,4096) =3D 4096 (0x1000)=0Ammap(0x0,1155072= ,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_NOCORE,3,0x0) =3D 34366242816 (0x80063= 4000)=0A=0ASo the size of the file is 115560 but mmap() length is 1155072. = The memory map of the file corresponding to libm as seen from running 'cat = /proc//map' is the following:=0A=0A0x800634000 0x80064c000 24 0 0xff= ffff002553eca8 r-x 108 54 0x0 COW NC vnode /lib/libm.so.5=0A0x80064c000 0x8= 0064d000 1 0 0xffffff01d79b0a20 r-x 1 0 0x3100 COW NNC vnode /lib/libm.so.5= =0A0x80064d000 0x80074c000 3 0 0xffffff002553eca8 r-x 108 54 0x0 COW NC vno= de /lib/libm.so.5=0A0x80074c000 0x80074e000 2 0 0xffffff01d79f1288 rw- 1 0 = 0x3100 COW NNC vnode /lib/libm.so.5=0A=0A=0Awhen the program tries to fault= -in all the pages as part of call to mlockall(), the following check in vm_= fault() fails when trying to fault-in 0x800651000.=0A=0Aif (fs.pindex >=3D = fs.object->size) {=0A unlock_and_deallocate(&fs);=0A return (KERN_P= ROTECTION_FAILURE);=0A}=0A=0Asince the object size corresponds to size of l= ibm and fault address is one page beyond the object size. Is this a bug ?= =0A=0AThanks,=0ASushanth=0A=0A