public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/17208] New: pthread_cond_wait may put mutex into incorrect state if mutex has elision disabled
@ 2014-07-28  6:41 robert at ocallahan dot org
  2014-07-28  7:18 ` [Bug nptl/17208] " robert at ocallahan dot org
  0 siblings, 1 reply; 2+ messages in thread
From: robert at ocallahan dot org @ 2014-07-28  6:41 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 17208
           Summary: pthread_cond_wait may put mutex into incorrect state
                    if mutex has elision disabled
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: robert at ocallahan dot org
                CC: drepper.fsp at gmail dot com

pthread_cond_wait calls __pthread_mutex_cond_lock_adjust after acquiring the
mutex's futex. __pthread_mutex_cond_lock_adjust has the following code:
  if (mutex->__data.__kind == PTHREAD_MUTEX_PI_RECURSIVE_NP)
    ++mutex->__data.__count;
I think this code should check PTHREAD_MUTEX_TYPE(mutex->__data.__kind).
Otherwise, if the mutex is recursive but __kind has the
PTHREAD_MUTEX_ELISION_NP or PTHREAD_MUTEX_NO_ELISION_NP, __count will not be
incremented and a later pthread_mutex_unlock of the mutex goes wrong,
decrementing __count from 0 to 0xffffffff and failing to unlock the mutex.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug nptl/17208] pthread_cond_wait may put mutex into incorrect state if mutex has elision disabled
  2014-07-28  6:41 [Bug nptl/17208] New: pthread_cond_wait may put mutex into incorrect state if mutex has elision disabled robert at ocallahan dot org
@ 2014-07-28  7:18 ` robert at ocallahan dot org
  0 siblings, 0 replies; 2+ messages in thread
From: robert at ocallahan dot org @ 2014-07-28  7:18 UTC (permalink / raw)
  To: glibc-bugs

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

Robert O'Callahan <robert at ocallahan dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Robert O'Callahan <robert at ocallahan dot org> ---
Never mind, I see that recursive mutexes should never use elision so this
doesn't come up.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-28  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28  6:41 [Bug nptl/17208] New: pthread_cond_wait may put mutex into incorrect state if mutex has elision disabled robert at ocallahan dot org
2014-07-28  7:18 ` [Bug nptl/17208] " robert at ocallahan dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).