From owner-freebsd-threads@FreeBSD.ORG Wed Jul 25 18:04:57 2012 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 E2C19106564A for ; Wed, 25 Jul 2012 18:04:57 +0000 (UTC) (envelope-from freebsdml@marino.st) Received: from shepard.synsport.net (mail.synsport.com [208.69.230.148]) by mx1.freebsd.org (Postfix) with ESMTP id B7F638FC12 for ; Wed, 25 Jul 2012 18:04:57 +0000 (UTC) Received: from [192.168.1.33] (123.red-81-32-112.dynamicip.rima-tde.net [81.32.112.123]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by shepard.synsport.net (Postfix) with ESMTP id 76516438BE for ; Wed, 25 Jul 2012 13:04:50 -0500 (CDT) Message-ID: <50103539.5090200@marino.st> Date: Wed, 25 Jul 2012 20:04:41 +0200 From: John Marino User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129 Thunderbird/10.0 MIME-Version: 1.0 To: freebsd-threads@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: 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:04:58 -0000 Hi guys, I know this isn't a thread issue, but I'm hoping one of you either knows the answer or can point me to someone that does. After I patched lib/libthr/thread/thr_setschedparam.c, all the threading issues with the GNAT testsuite running on FreeBSD 9.0 disappeared. On i386-FreeBSD, GNAT passes all tests perfectly. This is not the case for x86_64-FreeBSD. GNAT fails all the stack-check / dereference tests. It can no longer detect when it's at the end of the stack during the unwind process, because it can't find the signal trampoline. For FreeBSD, it was easy. Use the kern.ps_strings sysctl and subtract X from it's address (where X is 128 on i386 and 32 on AMD64). If the stack pointer is between the addr kern.ps_strings and addr kern.ps_strings - X then it's at the end of the stack. For AMD64, according to GDB, it seems the signal trampoline frame is now ahead of the ps_strings address rather than behind it. 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 end-of-stack detection as well. It uses the same algorithm. I haven't tested this on FreeBSD 9.1 beta - just 9.0 release. Regards, John