about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorJiyoung Yun <t2wish@gmail.com>2016-06-30 01:15:44 +0900
committerAndreas Schwab <schwab@suse.de>2016-07-07 14:33:32 +0200
commitd3016ce02c7ba85c1c619771bb1aa349038626cd (patch)
tree4568321e44b23afe3ff558026ce9eef00124fb58 /nptl
parent318132f4d41a5742c37d37d67529c24d28797d8a (diff)
downloadglibc-d3016ce02c7ba85c1c619771bb1aa349038626cd.tar.gz
glibc-d3016ce02c7ba85c1c619771bb1aa349038626cd.tar.xz
glibc-d3016ce02c7ba85c1c619771bb1aa349038626cd.zip
Fix robust mutex daedlock [BZ #20263]
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.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/lowlevelrobustlock.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nptl/lowlevelrobustlock.c b/nptl/lowlevelrobustlock.c
index 3b988b2e31..efe307e68b 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,
-				   FUTEX_CLOCK_REALTIME, private);
+      int err = lll_futex_timed_wait_bitset (futex, newval, abstime,
+					     FUTEX_CLOCK_REALTIME, private);
+      /* The futex call timed out.  */
+      if (err == -ETIMEDOUT)
+         return -err;
 #endif
 
     try: