From owner-freebsd-emulation@FreeBSD.ORG Mon Nov 5 13:46:42 2007 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D10A416A418; Mon, 5 Nov 2007 13:46:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from gnome.kiev.sovam.com (gnome.kiev.sovam.com [212.109.32.24]) by mx1.freebsd.org (Postfix) with ESMTP id 42E6613C4B3; Mon, 5 Nov 2007 13:46:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com ([62.64.120.197]) by gnome.kiev.sovam.com with esmtp (Exim 4.67 (FreeBSD)) (envelope-from ) id 1Ip1Zp-000NDK-O7; Mon, 05 Nov 2007 15:01:13 +0200 Received: from [212.82.216.226] (helo=deviant.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1Ip1Zm-000Iwy-5e; Mon, 05 Nov 2007 15:01:12 +0200 Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id lA5D17E4034801; Mon, 5 Nov 2007 15:01:07 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id lA5D16Us034800; Mon, 5 Nov 2007 15:01:06 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 5 Nov 2007 15:01:06 +0200 From: Kostik Belousov To: "Valery V.Chikalov" Message-ID: <20071105130106.GQ37471@deviant.kiev.zoral.com.ua> References: <472B0454.9040408@chikalov.dp.ua> <472B9CD1.1010607@chikalov.dp.ua> <472DAF60.9040008@chikalov.dp.ua> <20071104122023.GA5528@freebsd.org> <472DC7C3.3090105@chikalov.dp.ua> <20071104133518.GA7275@freebsd.org> <20071104171423.GL37471@deviant.kiev.zoral.com.ua> <472E067A.5050601@chikalov.dp.ua> <20071105095053.GP37471@deviant.kiev.zoral.com.ua> <472F0F82.8070002@chikalov.dp.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GuCODRLlE2VjZS/b" Content-Disposition: inline In-Reply-To: <472F0F82.8070002@chikalov.dp.ua> User-Agent: Mutt/1.4.2.3i X-Scanner-Signature: b72b012eade34d4806fecc225a7d7ed8 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 1735 [Nov 04 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: freebsd-emulation@freebsd.org Subject: Re: Linux emulation on FreeBSD AMD64 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Nov 2007 13:46:43 -0000 --GuCODRLlE2VjZS/b Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 05, 2007 at 02:41:38PM +0200, Valery V.Chikalov wrote: > Kostik Belousov wrote: > >On Sun, Nov 04, 2007 at 07:50:50PM +0200, Valery V.Chikalov wrote: > >>Kostik Belousov wrote: > >>[...] > >> > >>Index: vmparam.h > >>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >>RCS file: /home/ncvs/src/sys/amd64/include/vmparam.h,v > >>retrieving revision 1.49 > >>diff -u -r1.49 vmparam.h > >>--- vmparam.h 25 Sep 2007 06:25:04 -0000 1.49 > >>+++ vmparam.h 4 Nov 2007 14:43:39 -0000 > >>@@ -45,6 +45,10 @@ > >> #ifndef _MACHINE_VMPARAM_H_ > >> #define _MACHINE_VMPARAM_H_ 1 > >> > >>+#ifdef COMPAT_IA32 > >>+#define VM_PROT_READ_IS_EXEC /* if you can read -- then you can exe= c=20 > >>*/ > >>+#endif > >>+ > >No, this is wrong fix. It changes the ABI for freebsd binaries, and does > >this not only for SysV shm, but for any readable mapping. > > > >Instead, the following things shall be made: >=20 > Thanks, will try to do it this way. >=20 > But, just for curiosity and for my education. >=20 > My point from teh beginning was: we must find differences between linux= =20 > emulations in __i386__ and __amd64__(dont take it too literally, I dont= =20 > mean diff /sys/i386/xxx /sys/amd64/xxx :-)), because oracle is running=20 > perfectly in __i386__ mode and failed to run in __amd64__. >=20 > On the first glance such difference was found: VM_PROT_READ_IS_EXEC is=20 > defined in /sys/[i386|arm]/include/vmparam.h but not in=20 > /sys/amd64/include/vmparam.h. AMD64 (and, in fact, some i386, when running in PAE mode) has so-called execution-disable bit in the page protection attributes. The patch would make the PROT_READ =3D=3D PROT_READ | PROT_EXEC unconditionally. >=20 > But: > 1) you claim that this is wrong. > So, why? Why this is right for i386|arm and wrong for amd64. >=20 > > 1. linux_shmat() shall call kern_shmat(). > > 2. kern_shmat() shall take the flag that would force the read mapping > > to be also executable. > > 3. this flag shall be set when kern_shmat() is called from linux_shmat(= ), > > and not set when called from shmat(). >=20 > Why this is not applicable to i386 mode? Good question, I did not looked into the details of handling PROT_EXEC on i386 when nx bit is supported. FreeBSD definitely ignores PT_GNU_STACK for non-executable stacks, I am not sure what could break with this on i386. --GuCODRLlE2VjZS/b Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHLxQRC3+MBN1Mb4gRAqTMAKCroUU1OC9jv1GFVIsUnmOYTEvHhwCgwtOn jx+2sD5eRBGzKpTHTklOTsg= =LITX -----END PGP SIGNATURE----- --GuCODRLlE2VjZS/b--