diff mbox

Fix robust mutex daedlock [BZ #20263]

Message ID 1467216944-7104-1-git-send-email-t2wish@gmail.com
State New
Headers show

Commit Message

Jiyoung Yun June 29, 2016, 4:15 p.m. UTC
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 | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Andreas Schwab July 7, 2016, 12:35 p.m. UTC | #1
I have installed that now.

Andreas.
diff mbox

Patch

diff --git a/ChangeLog b/ChangeLog
index 3da2eca..97461f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-06-28  Jiyoung Yun  <t2wish@gmail.com>
+
+	[BZ #20263]
+	* nptl/lowlevelrobustlock.c: Implement ETIMEDOUT logic.
+
 2016-06-28  Richard Henderson  <rth@redhat.com>
 
 	* elf/elf.h (EM_BPF): New.
diff --git a/nptl/lowlevelrobustlock.c b/nptl/lowlevelrobustlock.c
index 3b988b2..43caae7 100644
--- a/nptl/lowlevelrobustlock.c
+++ b/nptl/lowlevelrobustlock.c
@@ -118,8 +118,11 @@  __lll_robust_timedlock_wait (int *futex, const struct timespec *abstime,
      || !defined lll_futex_timed_wait_bitset)
       lll_futex_timed_wait (futex, newval, &rt, private);
 #else
-      lll_futex_timed_wait_bitset (futex, newval, abstime,
+      int err = lll_futex_timed_wait_bitset (futex, newval, abstime,
 				   FUTEX_CLOCK_REALTIME, private);
+      /* the futex call time out */
+      if (err == -ETIMEDOUT)
+         return -err;
 #endif
 
     try: