From owner-freebsd-threads@FreeBSD.ORG Wed Jul 25 18:10:48 2012 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AB511106575F for ; Wed, 25 Jul 2012 18:10:48 +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 2578B8FC08 for ; Wed, 25 Jul 2012 18:10:47 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q6PIAutP063639; Wed, 25 Jul 2012 21:10:56 +0300 (EEST) (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.5/8.14.5) with ESMTP id q6PIAhir090508; Wed, 25 Jul 2012 21:10:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q6PIAhSc090507; Wed, 25 Jul 2012 21:10:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 25 Jul 2012 21:10:43 +0300 From: Konstantin Belousov To: John Marino Message-ID: <20120725181043.GP2676@deviant.kiev.zoral.com.ua> References: <50103539.5090200@marino.st> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EdHV1ukt9aOURWQF" Content-Disposition: inline In-Reply-To: <50103539.5090200@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=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham 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: Signal trampoline frame changed location on FreeBSD 9 AMD64? 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: Wed, 25 Jul 2012 18:10:48 -0000 --EdHV1ukt9aOURWQF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 25, 2012 at 08:04:41PM +0200, John Marino wrote: > Hi guys, > I know this isn't a thread issue, but I'm hoping one of you either knows= =20 > the answer or can point me to someone that does. >=20 > After I patched lib/libthr/thread/thr_setschedparam.c, all the threading= =20 > issues with the GNAT testsuite running on FreeBSD 9.0 disappeared. On=20 > i386-FreeBSD, GNAT passes all tests perfectly. >=20 > This is not the case for x86_64-FreeBSD. GNAT fails all the stack-check= =20 > / dereference tests. It can no longer detect when it's at the end of=20 > the stack during the unwind process, because it can't find the signal=20 > trampoline. >=20 > For FreeBSD, it was easy. Use the kern.ps_strings sysctl and subtract X= =20 > from it's address (where X is 128 on i386 and 32 on AMD64). If the=20 > stack pointer is between the addr kern.ps_strings and addr=20 > kern.ps_strings - X then it's at the end of the stack. >=20 > For AMD64, according to GDB, it seems the signal trampoline frame is now= =20 > ahead of the ps_strings address rather than behind it. >=20 > Who can confirm this or conversely tell me how wrong I am? > By the way, if I'm right, it also breaks the base system's GDB=20 > end-of-stack detection as well. It uses the same algorithm. >=20 > I haven't tested this on FreeBSD 9.1 beta - just 9.0 release. =46rom quite some time, the signal trampoline was moved into the separate 'shared' page. This was done to allow to remove the executable permissions from the stack mapping. BTW, I do see that at least gdb 7.4.1 stock can detect our trampoline. In-tree gdb indeed have issue understanding signal stack frame. The way forward is to implement vdso and add dwarf annotation to the trampoline code. --EdHV1ukt9aOURWQF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlAQNqMACgkQC3+MBN1Mb4gzeACbBjL47IdcOCdmquzxyLZHQa7s +JwAoOTaPMDZHz/Y+6GU5fXwTmF4VymJ =g6Ae -----END PGP SIGNATURE----- --EdHV1ukt9aOURWQF--