From 0a6690b745655e8a1f1d60474095435cbe58abd7 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Sun, 13 Aug 2023 16:29:04 +0300 Subject: [PATCH] LibC: Fix passing futex value for FUTEX_WAKE_BITSET FUTEX_WAKE_BITSET, like FUTEX_WAKE, accepts the number of waiting threads to wake, not the current value of the futex. Pass UINT32_MAX instead. --- Userland/Libraries/LibC/pthread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibC/pthread.cpp b/Userland/Libraries/LibC/pthread.cpp index 6dbce4a45f..5e7947c9fa 100644 --- a/Userland/Libraries/LibC/pthread.cpp +++ b/Userland/Libraries/LibC/pthread.cpp @@ -852,7 +852,7 @@ int pthread_rwlock_unlock(pthread_rwlock_t* lockval_p) auto desired = current & ~(writer_locked_mask | writer_intent_mask); AK::atomic_store(lockp, desired, AK::MemoryOrder::memory_order_release); // Then wake both readers and writers, if any. - auto rc = futex(lockp, FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG, current, nullptr, nullptr, (current & writer_wake_mask) | reader_wake_mask); + auto rc = futex(lockp, FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG, UINT32_MAX, nullptr, nullptr, (current & writer_wake_mask) | reader_wake_mask); if (rc < 0) return errno; return 0;