This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/20263] robust mutex deadlocks if other thread requests timedlock (Only arm/linux)
- From: "t2wish at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 21 Jun 2016 08:03:53 +0000
- Subject: [Bug nptl/20263] robust mutex deadlocks if other thread requests timedlock (Only arm/linux)
- Auto-submitted: auto-generated
- References: <bug-20263-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=20263
--- Comment #5 from Jiyoung Yun <t2wish at gmail dot com> ---
Thanks Florian Weimer!
When I fixed some code, my simple test is working properly. Please see the
below code. (Unfortunately in my office I can't clone the glibc repo...)
index 3a2725c..3c54ddd 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 ETIMEDOUT;
+
try:
;
}
pthread_cond_Timedout
pthread_rwlock_timedrdlock
pthread_rwlock_timedwrlock
These codes are already handled the same situation. But in this case(robust
mutex) it doesn't. The lll_futex_timed_wait_bitset function was already
returned the -ETIMEDOUT but we skipped it. And it makes a daedlock.
--
You are receiving this mail because:
You are on the CC list for the bug.