futex: Prepare futex_lock_pi() for runtime clock selection
authorThomas Gleixner <tglx@linutronix.de>
Thu, 22 Apr 2021 19:44:22 +0000 (21:44 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 22 Jun 2021 14:42:08 +0000 (16:42 +0200)
commite112c41341c03d9224a9fc522bdb3539bc849b56
treeebdf35aeef76543b9af96ebd50848d2833dd89cf
parent1a8122960484b19d8d887fb32e1cf42be5647533
futex: Prepare futex_lock_pi() for runtime clock selection

futex_lock_pi() is the only futex operation which cannot select the clock
for timeouts (CLOCK_MONOTONIC/CLOCK_REALTIME). That's inconsistent and
there is no particular reason why this cannot be supported.

This was overlooked when CLOCK_REALTIME_FLAG was introduced and
unfortunately not reported when the inconsistency was discovered in glibc.

Prepare the function and enforce the CLOCK_REALTIME_FLAG on FUTEX_LOCK_PI
so that a new FUTEX_LOCK_PI2 can implement it correctly.

Reported-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210422194705.338657741@linutronix.de
kernel/futex.c