glibc issues with --enable-kernel=

Bryan Kadzban bryan at
Sun Jan 23 15:02:42 PST 2011

Bryan Kadzban wrote:
> But from looking at the test code, it doesn't appear to be directly
> dealing with any of these __ASSUME_BLAH symbols.  It appears to be using
> standard pthread_blahblah() functions, so if the test is segfaulting, or
> getting the wrong result back, I'd expect that user programs calling the
> various pthread APIs would do the same.  So I *think* the cause of the
> failure is in the implementation of these functions.

Yep, confirmed.  (Also, it appears this had been submitted to glibc
bugzilla already, but was closed as basically "we won't help you debug
our stuff, and we think it's working": -- I've added
lots more info there, and the patch I'm attaching here as well.)

The core problem here is a stack imbalance.  This was actually broken
way back in July of 2009, when this code was added, in both of these

The second isn't as big of a problem, since the only thing broken is CFI
directives to the assembler (which will break debugging info, but I
don't *think* they'll break the code at runtime).  But the first, if
(which is the state we're seeing), will push a new register onto the
stack, and add some local-variable space, at function entry, and will
*not* clean these two up at function exit.  So the "retq" instruction at
the end will jump off into never-never land, to either an address coming
from garbage on the stack, or to an address coming from a random other

I've verified that this patch fixes the problem.  This might be possible
with sed, but I'm not sure how -- but one or the other of these should
be done, I think.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: glibc-2.12.2-fix-x86_64-rwlock-stack-imbalance-1.patch
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the lfs-dev mailing list