From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 18 06:17:13 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7C8B821A; Wed, 18 Sep 2013 06:17:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E48E72F82; Wed, 18 Sep 2013 06:17:12 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r8I6Fs4U018629; Wed, 18 Sep 2013 09:15:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r8I6Fs4U018629 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r8I6Fss0018628; Wed, 18 Sep 2013 09:15:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 18 Sep 2013 09:15:54 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: mmap on emulated i386 Message-ID: <20130918061554.GV41229@kib.kiev.ua> References: <31F58652-AB49-4B52-91C0-17A017350903@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lyUH/k0fSu9PvB7j" Content-Disposition: inline In-Reply-To: <31F58652-AB49-4B52-91C0-17A017350903@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: FreeBSD Mailing List X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Sep 2013 06:17:13 -0000 --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 #include #include 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--