Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Sep 2013 09:15:54 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Rui Paulo <rpaulo@FreeBSD.org>
Cc:        FreeBSD Mailing List <freebsd-hackers@freebsd.org>
Subject:   Re: mmap on emulated i386
Message-ID:  <20130918061554.GV41229@kib.kiev.ua>
In-Reply-To: <31F58652-AB49-4B52-91C0-17A017350903@FreeBSD.org>
References:  <31F58652-AB49-4B52-91C0-17A017350903@FreeBSD.org>

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

--lyUH/k0fSu9PvB7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Sep 17, 2013 at 07:01:16PM -0700, Rui Paulo wrote:
> Hi,
>=20
> I'm trying to figure out why the following fails when compiled on amd64 w=
ith -m32:
>=20
> 	mmap(NULL, 0x70000, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE=
, -1, 0);
>=20
> It returns EINVAL. I looked around everywhere but I couldn't find where t=
he EINVAL is coming from. The length argument doesn't really make any diffe=
rence. At this point I'm thinking it's a bug...

What is the version of your system, including the userspace ? -m32 only
works on HEAD.  Do you have r255657/r255658 in your kernel ?

Please provide kdump of the ktraced execution of your test program, as
well as the test program itself.

N.B. The following worked fine for me, both in 64 and 32 bit binary.

#include <sys/mman.h>
#include <err.h>
#include <stdlib.h>

int
main(void)
{
	char *p;

	p =3D mmap(NULL, 0x70000, PROT_READ | PROT_WRITE | PROT_EXEC,
	    MAP_ANON | MAP_PRIVATE, -1, 0);
	if (p =3D=3D MAP_FAILED)
		err(1, "mmap");
	return (0);
}


--lyUH/k0fSu9PvB7j
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.21 (FreeBSD)

iQIcBAEBAgAGBQJSOUUZAAoJEJDCuSvBvK1BerUP/jxgIB3xeTLT7ieEiT+fZtL2
KulGPWW9+z87cJDdTB1V2OlobURIb91bX2+FEI1IzRJZWSf4jieZjCeqqUNJ6M8h
Vg5EqqbFUCJTT7JKnY4Km98JM+8K32AMAB9G5gS03VZZUWTY+Ru/BHIDvJ6fhgTj
bGGVEMuK31BROnzXfnyqQUqsvAFe93moYAR3cJe3valP1zy0bAn6R3VAtx2zZ3DL
NohX3JiErij3KPsafVFOOJwvNkjdSCF5u/Y6MJEGegobVf2/i07DhvM/g7gqndtr
KP8g8eaTwMzz+cC3GXRkNMBQBT+66PnWuvS94o7OPhnAP7Vpc5E5+k7fS68d2ldQ
ohtuXlJbmkW5AItBOnrdTZ0F81sSx8kWgzfk/7NofwrRl93+f2Ut9vmccm/QvC+f
E1UakrzxntdGtpMOfBC2X45BsKtGWm/OZ1l7xH5+HFUIIMrGd2KancBQLoDW7v1W
OLRWyG1WyRWQtD1PDBVvCbwc8/s0EEZHQ5EeQCZOq2193TWn36AC/8Vs/YcYEep8
HP02quXVtY5a8eVgvbgOamYF48WSUGVIBNao3jGHRrLrAQ8MJaY29BM8jUYBp66o
U128LXWcnmjRDLI/t20sz1ChrvA5siG8OGb1LZbykLhUoGu1kWqNAmrHRSzJOxgQ
7SHiNNjpxB9jivwXd+zV
=f+Ja
-----END PGP SIGNATURE-----

--lyUH/k0fSu9PvB7j--



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