This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/13165] pthread_cond_wait() can consume a signal that was sent before it started waiting
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sat, 16 Aug 2014 22:19:20 +0000
- Subject: [Bug nptl/13165] pthread_cond_wait() can consume a signal that was sent before it started waiting
- Auto-submitted: auto-generated
- References: <bug-13165-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=13165
--- Comment #38 from Rich Felker <bugdal at aerifal dot cx> ---
I just read the source for pthread_cond_wait and the cause of the bug is
obvious: the mutex is being unlocked before the current thread acquires the
internal lock in the cond var and adds itself as a waiter. Simply moving the
mutex unlock to somewhere after this point (e.g. right before the futex wait
loop) should fix the problem. This is necessary to meet the requirement that
formally becoming a waiter is atomic with unlocking of the mutex, rather than
happening at some time after unlocking the mutex with a race window in between.
If someone else could test this fix, I would appreciate it since I don't have
an environment setup for building and testing new glibc builds.
--
You are receiving this mail because:
You are on the CC list for the bug.