This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/13165] pthread_cond_wait() can consume a signal that was sent before it started waiting


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]