This is a note to let you know that I've just added the patch titled futex: Avoid freeing an active timer to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: futex-avoid-freeing-an-active-timer.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Mon Mar 29 07:48:09 AM CEST 2021 From: Ben Hutchings <ben@xxxxxxxxxxxxxxx> Date: Sun, 28 Mar 2021 22:42:00 +0200 Subject: futex: Avoid freeing an active timer To: stable@xxxxxxxxxxxxxxx Cc: Lee Jones <lee.jones@xxxxxxxxxx>, "Luis Claudio R. Goncalves" <lgoncalv@xxxxxxxxxx>, Florian Fainelli <f.fainelli@xxxxxxxxx> Message-ID: <YGDqGB/tmAa2cjOz@xxxxxxxxxxxxxxx> Content-Disposition: inline From: Thomas Gleixner <tglx@xxxxxxxxxxxxx> commit 97181f9bd57405b879403763284537e27d46963d upstream. Alexander reported a hrtimer debug_object splat: ODEBUG: free active (active state 0) object type: hrtimer hint: hrtimer_wakeup (kernel/time/hrtimer.c:1423) debug_object_free (lib/debugobjects.c:603) destroy_hrtimer_on_stack (kernel/time/hrtimer.c:427) futex_lock_pi (kernel/futex.c:2740) do_futex (kernel/futex.c:3399) SyS_futex (kernel/futex.c:3447 kernel/futex.c:3415) do_syscall_64 (arch/x86/entry/common.c:284) entry_SYSCALL64_slow_path (arch/x86/entry/entry_64.S:249) Which was caused by commit: cfafcd117da0 ("futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()") ... losing the hrtimer_cancel() in the shuffle. Where previously the hrtimer_cancel() was done by rt_mutex_slowlock() we now need to do it manually. Reported-by: Alexander Levin <alexander.levin@xxxxxxxxxxx> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Fixes: cfafcd117da0 ("futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()") Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1704101802370.2906@nanos Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx> Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/futex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3018,8 +3018,10 @@ out_unlock_put_key: out_put_key: put_futex_key(&q.key); out: - if (to) + if (to) { + hrtimer_cancel(&to->timer); destroy_hrtimer_on_stack(&to->timer); + } return ret != -EINTR ? ret : -ERESTARTNOINTR; uaddr_faulted: Patches currently in stable-queue which might be from ben@xxxxxxxxxxxxxxx are queue-4.9/futex-drop-hb-lock-before-enqueueing-on-the-rtmutex.patch queue-4.9/futex-rework-futex_lock_pi-to-use-rt_mutex_-_proxy_lock.patch queue-4.9/futex-avoid-freeing-an-active-timer.patch queue-4.9/futex-rt_mutex-introduce-rt_mutex_init_waiter.patch queue-4.9/futex-fix-incorrect-should_fail_futex-handling.patch queue-4.9/futex-rt_mutex-fix-rt_mutex_cleanup_proxy_lock.patch queue-4.9/futex-use-smp_store_release-in-mark_wake_futex.patch queue-4.9/futex-fix-possible-missed-wakeup.patch queue-4.9/locking-futex-allow-low-level-atomic-operations-to-return-eagain.patch queue-4.9/futex-prevent-robust-futex-exit-race.patch queue-4.9/futex-handle-transient-ownerless-rtmutex-state-correctly.patch queue-4.9/futex-handle-early-deadlock-return-correctly.patch queue-4.9/arm64-futex-bound-number-of-ldxr-stxr-loops-in-futex_wake_op.patch