Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Apr 2012 12:57:26 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Sushanth Rai <sushanth_rai@yahoo.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: mlockall() on freebsd 7.2 + amd64 returns EAGAIN
Message-ID:  <20120410095726.GU2358@deviant.kiev.zoral.com.ua>
In-Reply-To: <1334025431.77315.YahooMailClassic@web180011.mail.gq1.yahoo.com>
References:  <1334025431.77315.YahooMailClassic@web180011.mail.gq1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Mj2Hoq6zy/C4bu/j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Apr 09, 2012 at 07:37:11PM -0700, Sushanth Rai wrote:
> Hello,
>=20
> I have a simple program that links with the math library. The only thing =
that program does is to call mlockall(MCL_CURRENT | MCL_FUTURE). This call =
to mlockall fails with EAGAIN. I figured out that kernel vm_fault() is retu=
rning KERN_PROTECTION_FAILURE when it tries to fault-in the mmap'ed math li=
brary address. But I can't figure why.
>=20
> The /proc/<mypid>/map returns the following for the process:
>=20
> 0x800634000 0x80064c000 24 0 0xffffff0025571510 r-x 104 52 0x1000 COW NC =
vnode /lib/libm.so.5
> 0x80064c000 0x80064d000 1 0 0xffffff016f11c5e8 r-x 1 0 0x3100 COW NNC vno=
de /lib/libm.so.5
> 0x80064d000 0x80074c000 4 0 0xffffff0025571510 r-x 104 52 0x1000 COW NC v=
node /lib/libm.so.5
>=20
> Since ntpd calls mlockall with same option and links with math library to=
o, I look at map o/p of ntpd, which looks slightly different "resident" col=
umn (3rd column) on 3rd line:
> 0x800682000 0x80069a000 8 0 0xffffff0025571510 r-x 100 50 0x1000 COW NC v=
node /lib/libm.so.5
> 0x80069a000 0x80069b000 1 0 0xffffff0103b85870 r-x 1 0 0x3100 COW NNC vno=
de /lib/libm.so.5
> 0x80069b000 0x80079a000 0 0 0xffffff0025571510 r-x 100 50 0x1000 COW NC v=
node /lib/libm.so.5
>=20
> I don't know if that has anything to do with failure. The snippet of code=
 that returns failure in vm_fault() is the following:
>=20
> if (fs.pindex >=3D fs.object->size) {
>       unlock_and_deallocate(&fs);
>       return (KERN_PROTECTION_FAILURE);
> }
>=20
> Any help would be appreciated.

This might be a bug fixed in r191810, but I am not sure.

--Mj2Hoq6zy/C4bu/j
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAk+EBAYACgkQC3+MBN1Mb4j/rwCfUuRzzcpojQKcbf3Awqug6XM4
zWIAoIg3OXTe5bLFWJ4y7UX7BDchPl5f
=kr3c
-----END PGP SIGNATURE-----

--Mj2Hoq6zy/C4bu/j--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120410095726.GU2358>