Skip to content

Commit d19a456

Browse files
KAGA-KOKOgregkh
authored andcommitted
futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI
commit cdf78db upstream. 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 <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210422194704.984540159@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2543329 commit d19a456

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/futex.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3784,7 +3784,7 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
37843784
t = timespec64_to_ktime(ts);
37853785
if (cmd == FUTEX_WAIT)
37863786
t = ktime_add_safe(ktime_get(), t);
3787-
else if (!(op & FUTEX_CLOCK_REALTIME))
3787+
else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME))
37883788
t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
37893789
tp = &t;
37903790
}
@@ -3978,7 +3978,7 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
39783978
t = timespec64_to_ktime(ts);
39793979
if (cmd == FUTEX_WAIT)
39803980
t = ktime_add_safe(ktime_get(), t);
3981-
else if (!(op & FUTEX_CLOCK_REALTIME))
3981+
else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME))
39823982
t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
39833983
tp = &t;
39843984
}

0 commit comments

Comments
 (0)