Signal trampoline frame changed location on FreeBSD 9 AMD64?

John Marino freebsdml at marino.st
Wed Jul 25 18:04:58 UTC 2012


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


More information about the freebsd-threads mailing list