From owner-freebsd-threads@FreeBSD.ORG Fri Dec 31 19:46:24 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA924106566B for ; Fri, 31 Dec 2010 19:46:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 69E2D8FC0C for ; Fri, 31 Dec 2010 19:46:22 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id oBVJkJGt041344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 31 Dec 2010 21:46:19 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id oBVJkJth037731; Fri, 31 Dec 2010 21:46:19 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id oBVJkJTq037730; Fri, 31 Dec 2010 21:46:19 +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: Fri, 31 Dec 2010 21:46:19 +0200 From: Kostik Belousov To: John Marino Message-ID: <20101231194619.GS90883@deviant.kiev.zoral.com.ua> References: <4D1DC299.2090808@marino.st> <20101231122225.GK90883@deviant.kiev.zoral.com.ua> <4D1DCE02.3050601@marino.st> <20101231125215.GL90883@deviant.kiev.zoral.com.ua> <4D1DD5CF.5020305@marino.st> <20101231132706.GN90883@deviant.kiev.zoral.com.ua> <4D1DDC99.7000400@marino.st> <20101231134418.GO90883@deviant.kiev.zoral.com.ua> <4D1E30EA.7050308@marino.st> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Y+49MuJt7Df6jcOH" Content-Disposition: inline In-Reply-To: <4D1E30EA.7050308@marino.st> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-threads@freebsd.org Subject: Re: AMD64 version of GNAT Ada compiler broken due to libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2010 19:46:24 -0000 --Y+49MuJt7Df6jcOH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 31, 2010 at 08:37:14PM +0100, John Marino wrote: > Hi Kostik, >=20 > Thanks for pointing me in the right direction. After some research, I=20 > discovered that only DragonFly BSD allows execution on the stack by=20 > default. NetBSD and OpenBSD (and Solaris and Darwin) all were specially= =20 > configured within gcc to execute mprotect first to enable this=20 > functionality. FreeBSD never had this gcc configuration code and=20 > frankly it looks like it should have already been there. >=20 > I created my own __enable_execute_stack macro function based on these=20 > previous works and now GNAT has passed all tests! Since i386 always=20 > worked, I only applied to macro to the AMD64 configuration header. You need the same application of mprotect() for i386 too, since 32bit binary executed on amd64 kernel gets non-executable stack as well. >=20 > You've been a great help! Once I understood what the issue was,=20 > everything fell into place. Will you upstream the changes to gcc ? >=20 > -- John >=20 >=20 > Kostik Belousov wrote: > >On Fri, Dec 31, 2010 at 02:37:29PM +0100, John Marino wrote: > >>Yeah, that's kind of what I was getting at. Would this patch get into= =20 > >>FreeBSD 8.2, and would that mean that GNAT would start working properly= =20 > >>starting with FreeBSD 8.2 if that happened? > >Definitely not in 8.2. > >Might be in 8.3, if successfully landed in HEAD. > > > >Besides the patch for the base system, compiler must be configured > >to properly mark the objects that need executable thunks on the stack. > >See the references in the arch@ message I pointed to. > > > >>I guess that also means the other BSD's have been allowing executable= =20 > >>stacks all along. > >Or, there is a compiler configuration that prevents using the thunks > >on the stack. --Y+49MuJt7Df6jcOH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk0eMwoACgkQC3+MBN1Mb4jBfgCcDEREfiAa4wpplDR5dWTgK/kw HJEAoOPJ+Nfr2yNaPwoTAgE8zStHRQJn =U9Zg -----END PGP SIGNATURE----- --Y+49MuJt7Df6jcOH--