Skip to content

Commit 4fbf5d6

Browse files
committed
Revert 337f130 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")
The FUTEX_WAIT operand has historically a relative timeout which means that the clock id is irrelevant as relative timeouts on CLOCK_REALTIME are not subject to wall clock changes and therefore are mapped by the kernel to CLOCK_MONOTONIC for simplicity. If a caller would set FUTEX_CLOCK_REALTIME for FUTEX_WAIT the timeout is still treated relative vs. CLOCK_MONOTONIC and then the wait arms that timeout based on CLOCK_REALTIME which is broken and obviously has never been used or even tested. Reject any attempt to use FUTEX_CLOCK_REALTIME with FUTEX_WAIT again. The desired functionality can be achieved with FUTEX_WAIT_BITSET and a FUTEX_BITSET_MATCH_ANY argument. Fixes: 337f130 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op") Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 28ce0e7 commit 4fbf5d6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/futex.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3710,8 +3710,7 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
37103710

37113711
if (op & FUTEX_CLOCK_REALTIME) {
37123712
flags |= FLAGS_CLOCKRT;
3713-
if (cmd != FUTEX_WAIT && cmd != FUTEX_WAIT_BITSET && \
3714-
cmd != FUTEX_WAIT_REQUEUE_PI)
3713+
if (cmd != FUTEX_WAIT_BITSET && cmd != FUTEX_WAIT_REQUEUE_PI)
37153714
return -ENOSYS;
37163715
}
37173716

0 commit comments

Comments
 (0)