|
From: Paul F. <pa...@so...> - 2023-02-28 21:19:49
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=94a41e050c92a504515c66ebdaf84cad91c869bb commit 94a41e050c92a504515c66ebdaf84cad91c869bb Author: Paul Floyd <pj...@wa...> Date: Tue Feb 28 22:17:25 2023 +0100 Bug 445743 - "The impossible happened: mutex is locked simultaneously by two threads" while using mutexes with priority inheritance and signals Been using the same fix in FreeBSD for quite a while, so I think it's safe to apply to Linux and close the bugzi item. Diff: --- NEWS | 4 +++- coregrind/m_syswrap/syswrap-linux.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c6ebdcb252..e31fc3c50d 100644 --- a/NEWS +++ b/NEWS @@ -87,6 +87,8 @@ are not entered into bugzilla tend to get forgotten about or ignored. 444110 priv/guest_ppc_toIR.c:36198:31: warning: duplicated 'if' condition. 444488 Use glibc.pthread.stack_cache_size tunable 444568 drd/tests/pth_barrier_thr_cr fails on Fedora 38 +445743 "The impossible happened: mutex is locked simultaneously by two threads" + while using mutexes with priority inheritance and signals 459476 vgdb: allow address reuse to avoid "address already in use" errorsuse" errors 460356 s390: Sqrt32Fx4 -- cannot reduce tree 462830 WARNING: unhandled amd64-freebsd syscall: 474 @@ -95,7 +97,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 464859 Build failures with GCC-13 (drd tsan_unittest) 464969 D language demangling 465435 m_libcfile.c:66 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit)' failed. -n-i-bz FreeBSD rfork syscall fail with EINVAL or EINVAL rather than VG_(unimplemented) +n-i-bz FreeBSD rfork syscall fail with EINVAL or ENOSYS rather than VG_(unimplemented) To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index bb87c90bab..4a5a93b35a 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1743,6 +1743,9 @@ static void futex_pre_helper ( ThreadId tid, SyscallArgLayout* layout, } *flags |= SfMayBlock; + if ((ARG2 & (VKI_FUTEX_PRIVATE_FLAG|VKI_FUTEX_LOCK_PI)) == (VKI_FUTEX_PRIVATE_FLAG|VKI_FUTEX_LOCK_PI)) { + *flags |= SfKernelRestart; + } switch(ARG2 & ~(VKI_FUTEX_PRIVATE_FLAG|VKI_FUTEX_CLOCK_REALTIME)) { case VKI_FUTEX_WAIT: |