From patchwork Wed Jun 29 15:03:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiyoung Yun X-Patchwork-Id: 13488 Received: (qmail 43577 invoked by alias); 29 Jun 2016 15:03:52 -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 43364 invoked by uid 89); 29 Jun 2016 15:03:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1684 X-HELO: mail-pf0-f194.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zketvzCn854XO8NXeioCILgeoO+m9lcqM2Rf4HZgXK4=; b=BXL108/o44MGFgrcL4fUQi63351i4PbuWMwhEdXs1u12qmJzpDRx+5YWFt8LFc9DzD xTmsJQ3toPIuPmhYNMYDOI9L8Miiy2wijdXBy/jTy5Xk+SpWG/wDPGOMalE+EtEbAK+K UGvmrc/8jkLtjNOUfgl9xBdb9VXq5ELiyU+gnl3PmjGl4oC4u9LXIJtTPtRaVO5xxtqS 9OkTcBAPmC4TI+19qp7374winjCwAyALBN4Z+wBXgzqPoFboiYD1kh06kNxBQ/7n4PLZ d/9OCt0V6zZ41vAuP0GagktmJdNlWwiRMVgOA8Xu3zu/jy9ay54Rj2WgtpxoxHgN1vvT d0GA== X-Gm-Message-State: ALyK8tLbfMNGfWRcT55xRDHwoCKybFqlGMUW1rTu+yH9EaCz0mPMWbl5C9DiyKXZ9mbcvw== X-Received: by 10.98.113.74 with SMTP id m71mr12671934pfc.6.1467212628882; Wed, 29 Jun 2016 08:03:48 -0700 (PDT) From: Jiyoung Yun To: libc-alpha@sourceware.org Cc: jy910.yun@samsung.com, Jiyoung Yun Subject: [PATCH v2 1/2] Fix robust mutex daedlock [BZ #20263] Date: Thu, 30 Jun 2016 00:03:40 +0900 Message-Id: <1467212621-5522-2-git-send-email-t2wish@gmail.com> In-Reply-To: <1467212621-5522-1-git-send-email-t2wish@gmail.com> References: <1467212621-5522-1-git-send-email-t2wish@gmail.com> In Linux/ARM environment, a robust mutex can't catch the timeout result when it is already owned by other thread and requests to try lock with a specific time value(pthread_mutex_timedlock). The futex already returns the ETIMEDOUT result but there is no check the return value and it makes a deadlock. * nptl/lowlevelrobustlock.c: Implement ETIMEDOUT logic. --- ChangeLog | 5 +++++ nptl/lowlevelrobustlock.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3da2eca..97461f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-28 Jiyoung Yun + + [BZ #20263] + * nptl/lowlevelrobustlock.c: Implement ETIMEDOUT logic. + 2016-06-28 Richard Henderson * elf/elf.h (EM_BPF): New. diff --git a/nptl/lowlevelrobustlock.c b/nptl/lowlevelrobustlock.c index 3b988b2..e5d3758 100644 --- a/nptl/lowlevelrobustlock.c +++ b/nptl/lowlevelrobustlock.c @@ -113,15 +113,20 @@ __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime, && atomic_compare_and_exchange_bool_acq (futex, newval, oldval)) continue; + int err; /* If *futex == 2, wait until woken or timeout. */ #if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \ || !defined lll_futex_timed_wait_bitset) - lll_futex_timed_wait (futex, newval, &rt, private); + err = lll_futex_timed_wait (futex, newval, &rt, private); #else - lll_futex_timed_wait_bitset (futex, newval, abstime, + err = lll_futex_timed_wait_bitset (futex, newval, abstime, FUTEX_CLOCK_REALTIME, private); #endif + /* the futex call time out */ + if (err == -ETIMEDOUT) + return -err; + try: ; }