1
0
Fork 0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-01-22 16:06:04 -05:00
linux/kernel/locking
John Stultz 82f9cc0949 locking: rtmutex: Fix wake_q logic in task_blocks_on_rt_mutex
Anders had bisected a crash using PREEMPT_RT with linux-next and
isolated it down to commit 894d1b3db4 ("locking/mutex: Remove
wakeups from under mutex::wait_lock"), where it seemed the
wake_q structure was somehow getting corrupted causing a null
pointer traversal.

I was able to easily repoduce this with PREEMPT_RT and managed
to isolate down that through various call stacks we were
actually calling wake_up_q() twice on the same wake_q.

I found that in the problematic commit, I had added the
wake_up_q() call in task_blocks_on_rt_mutex() around
__ww_mutex_add_waiter(), following a similar pattern in
__mutex_lock_common().

However, its just wrong. We haven't dropped the lock->wait_lock,
so its contrary to the point of the original patch. And it
didn't match the __mutex_lock_common() logic of re-initializing
the wake_q after calling it midway in the stack.

Looking at it now, the wake_up_q() call is incorrect and should
just be removed. So drop the erronious logic I had added.

Fixes: 894d1b3db4 ("locking/mutex: Remove wakeups from under mutex::wait_lock")
Closes: https://lore.kernel.org/lkml/6afb936f-17c7-43fa-90e0-b9e780866097@app.fastmail.com/
Reported-by: Anders Roxell <anders.roxell@linaro.org>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: John Stultz <jstultz@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Juri Lelli <juri.lelli@redhat.com>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/r/20241114190051.552665-1-jstultz@google.com
2024-12-02 12:01:29 +01:00
..
irqflag-debug.c
lock_events.c
lock_events.h
lock_events_list.h
lockdep.c lockdep: Use info level for lockdep initial info messages 2024-10-17 21:21:16 -07:00
lockdep_internals.h
lockdep_proc.c
lockdep_states.h
locktorture.c
Makefile
mcs_spinlock.h
mutex-debug.c
mutex.c locking/mutex: Expose __mutex_owner() 2024-10-14 12:52:41 +02:00
mutex.h locking/mutex: Expose __mutex_owner() 2024-10-14 12:52:41 +02:00
osq_lock.c locking/osq_lock: Use atomic_try_cmpxchg_release() in osq_unlock() 2024-10-25 10:01:50 +02:00
percpu-rwsem.c
qrwlock.c
qspinlock.c
qspinlock_paravirt.h locking/pvqspinlock: Convert fields of 'enum vcpu_state' to uppercase 2024-10-17 21:21:16 -07:00
qspinlock_stat.h
rtmutex.c locking: rtmutex: Fix wake_q logic in task_blocks_on_rt_mutex 2024-12-02 12:01:29 +01:00
rtmutex_api.c Scheduler changes for v6.13: 2024-11-19 14:16:06 -08:00
rtmutex_common.h locking/mutex: Remove wakeups from under mutex::wait_lock 2024-10-14 12:52:40 +02:00
rwbase_rt.c locking/mutex: Remove wakeups from under mutex::wait_lock 2024-10-14 12:52:40 +02:00
rwsem.c locking/mutex: Remove wakeups from under mutex::wait_lock 2024-10-14 12:52:40 +02:00
semaphore.c
spinlock.c
spinlock_debug.c
spinlock_rt.c Scheduler changes for v6.13: 2024-11-19 14:16:06 -08:00
test-ww_mutex.c locking/ww_mutex: Adjust to lockdep nest_lock requirements 2024-10-09 15:08:25 +02:00
ww_mutex.h locking/mutex: Make mutex::wait_lock irq safe 2024-10-14 12:52:40 +02:00
ww_rt_mutex.c