Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jul 2012 20:04:41 +0200
From:      John Marino <freebsdml@marino.st>
To:        freebsd-threads@freebsd.org
Subject:   Signal trampoline frame changed location on FreeBSD 9 AMD64?
Message-ID:  <50103539.5090200@marino.st>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50103539.5090200>