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/13690] pthread_mutex_unlock potentially cause invalid access


https://sourceware.org/bugzilla/show_bug.cgi?id=13690

--- Comment #25 from Rich Felker <bugdal at aerifal dot cx> ---
Torvald, while I agree there is *some* room for arguing about the semantics
intended by the standard, the fact of the matter is that it's really hard to
use mutexes that reside in dynamically-allocated memory if you can't rely on
the self-synchronized destruction semantics. Some common cases are easy, for
example, if you're freeing an object that's part of a larger data structure,
acquiring the lock on the larger data structure before locking the individual
object assures that another thread cannot still be in the tail part of the
pthread_mutex_unlock call for the individual object when you obtain the mutex.
But in general it's not so easy; at the very least, it requires non-trivial,
non-intuitive, error-prone reasoning to determine if any particular usage is
safe. And this is not good.

Fixing the bug, on the other hand, is not hard, so I think it should just be
fixed, even if the Austin Group chooses to relax this requirement. It's a
quality of implementation issue because, however it's resolved, many apps will
continue to have this kind of race condition on implementations where
self-synchronized destruction does not work, resulting in random
near-impossible-to-reproduce crashes.

-- 
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]