This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: bug in spinlock.c?
- From: Wolfram Gloger <Wolfram dot Gloger at dent dot med dot uni-muenchen dot de>
- To: aj at suse dot de
- Cc: libc-alpha at sources dot redhat dot com, kkeil at suse dot de
- Date: Fri, 21 Feb 2003 17:17:59 +0100 ("MET)
- Subject: Re: bug in spinlock.c?
- References: <hoadgpn6a2.fsf@byrd.suse.de>
> Looking at the ex18 hang (sometimes ex18 even segfaulted) on x86-64,
> Karsten noticed that we allocate a struct wait_node in
> __pthread_alt_lock on the stack - and put it somehow also on the list
> of waiting nodes.
Yes.
> In __pthread_alt_unlock we go through the waiting nodes and deque it.
>
> This looks broken, since we allocate something on the stack of a
> function and leave the function with this data hanging around.
?? No, the function __pthread_alt_lock is not left until the
wait_node has been signalled, check all the suspend(self); calls.
Basically, all this works because only one function can acquire the
lock.
> Can somebody confirm this? Or do you have other ideas that would
> explain the segfaults we noticed? gdb pointed to this code,
I've also seen gdb stacktraces like this many times, however the
actual spinlock code in LinuxThreads never was at fault, it was always
a double unlock or similar..
Regards,
Wolfram.