From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14890 invoked by alias); 28 Jul 2014 06:41:46 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 14846 invoked by uid 48); 28 Jul 2014 06:41:39 -0000 From: "robert at ocallahan dot org" To: glibc-bugs@sourceware.org Subject: [Bug nptl/17208] New: pthread_cond_wait may put mutex into incorrect state if mutex has elision disabled Date: Mon, 28 Jul 2014 06:41:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nptl X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: robert at ocallahan dot org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg00678.txt.bz2 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.