Skip to content

Commit cdf78db

Browse files
committed
futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI
FUTEX_LOCK_PI does not require to have the FUTEX_CLOCK_REALTIME bit set because it has been using CLOCK_REALTIME based absolute timeouts forever. Due to that, the time namespace adjustment which is applied when FUTEX_CLOCK_REALTIME is not set, will wrongly take place for FUTEX_LOCK_PI and wreckage the timeout. Exclude it from that procedure. Fixes: c2f7d08 ("futex: Adjust absolute futex timeouts with per time namespace offset") 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 4fbf5d6 commit cdf78db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/futex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3780,7 +3780,7 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
37803780
t = timespec64_to_ktime(ts);
37813781
if (cmd == FUTEX_WAIT)
37823782
t = ktime_add_safe(ktime_get(), t);
3783-
else if (!(op & FUTEX_CLOCK_REALTIME))
3783+
else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME))
37843784
t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
37853785
tp = &t;
37863786
}
@@ -3974,7 +3974,7 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
39743974
t = timespec64_to_ktime(ts);
39753975
if (cmd == FUTEX_WAIT)
39763976
t = ktime_add_safe(ktime_get(), t);
3977-
else if (!(op & FUTEX_CLOCK_REALTIME))
3977+
else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME))
39783978
t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
39793979
tp = &t;
39803980
}

0 commit comments

Comments
 (0)