From patchwork Sat Jan 23 20:27:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 572166 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B52A0140556 for ; Sun, 24 Jan 2016 07:28:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=BovBYOtd; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=ZCl8/MK8pRvjCh000VtGmKCF3/h5p3u5/YLv3Z1JubPoZJjIHQ7X4 KOnl4v9lVmD1kIbr4nBHUQzdNUmHtYjrG5RIvTTDh//KhdDlPkrGJJFMvo71w9QD /aegUZElwU7yqfCWq1s8Fsk+UyX3fqrnp2EqKiTM5/GeWYMCVYiqNA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=tznNyGhs5B1N1IVN2TdPJLkASeE=; b=BovBYOtdeExYGI6v2sBN4A3c2joM xmdKZcnKeOwt9igjw8VBS12P8ORiHfhkK22fOtDmfavrI84lBdh+UHXoIh/kR3iH 8NYHOId1xYKnGtIF+UJViYjpRq+BhkP5ghhVC35zFSymv6vL91/Ah6oqEFzH8V70 5EgjZLWxIn3eFr0= Received: (qmail 51578 invoked by alias); 23 Jan 2016 20:28:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 51565 invoked by uid 89); 23 Jan 2016 20:28:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Hx-languages-length:1612, tstsetuid3c, sk:is_inva, UD:tst-setuid3.c X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] pthread_mutex_unlock: fix wrong assertion with lock elision (bug#19515) Date: Sat, 23 Jan 2016 21:27:55 +0100 Message-Id: <1453580875-29240-1-git-send-email-aurelien@aurel32.net> Commit e8c659d7 slightly changed the mutex type to store the elision FLAG via the ELISION. It means the mutex type should no be accessed using PTHREAD_MUTEX_TYPE. One path has been forgotten in this patch, causing the assert to wrongly trigger when lock elision is enabled and available. Fix that. 2016-01-23 Aurelien Jarno [BZ #19515] * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): Use PTHREAD_MUTEX_TYPE to get the mutex type. --- ChangeLog | 6 ++++++ nptl/pthread_mutex_unlock.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9418e26..5f86942 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-01-23 Aurelien Jarno + + [BZ #19515] + * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt): + Use PTHREAD_MUTEX_TYPE to get the mutex type. + 2016-01-22 Paul E. Murphy * nptl/tst-setuid3.c (is_invalid_barrier_ret): New function. diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c index 334ce38..98571ae 100644 --- a/nptl/pthread_mutex_unlock.c +++ b/nptl/pthread_mutex_unlock.c @@ -82,7 +82,7 @@ __pthread_mutex_unlock_usercnt (pthread_mutex_t *mutex, int decr) else { /* Error checking mutex. */ - assert (type == PTHREAD_MUTEX_ERRORCHECK_NP); + assert (PTHREAD_MUTEX_TYPE (mutex) == PTHREAD_MUTEX_ERRORCHECK_NP); if (mutex->__data.__owner != THREAD_GETMEM (THREAD_SELF, tid) || ! lll_islocked (mutex->__data.__lock)) return EPERM;