milos-linux/kernel/locking
Davidlohr Bueso 40a25d59e8 locking/rtmutex: Skip remove_waiter() when waiter is not enqueued
syzbot triggered the following splat in remove_waiter() via
FUTEX_CMP_REQUEUE_PI:

  KASAN: null-ptr-deref in range [0x0000000000000a88-0x0000000000000a8f]
   class_raw_spinlock_constructor
   remove_waiter+0x159/0x1200 kernel/locking/rtmutex.c:1561
   rt_mutex_start_proxy_lock+0x103/0x120
   futex_requeue+0x10e4/0x20d0
   __x64_sys_futex+0x34f/0x4d0

task_blocks_on_rt_mutex() does not arm the waiter upon deadlock detection,
leaving waiter->task nil, where 3bfdc63936 ("rtmutex: Use waiter::task instead
of current in remove_waiter()") made this fatal.

Furthermore, rt_mutex_start_proxy_lock() should not be calling into remove_waiter()
upon a successfully grabbing the rtmutex. 1a1fb985f2 ("futex: Handle early deadlock
return correctly"), moved the remove_waiter() out of __rt_mutex_start_proxy_lock()
(where 'ret' was only ever 0 or < 0) into the wrapper. Tighten this check to
account for try_to_take_rt_mutex().

Fixes: 3bfdc63936 ("rtmutex: Use waiter::task instead of current in remove_waiter()")
Reported-by: syzbot+78147abe6c524f183ee9@syzkaller.appspotmail.com
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Closes: https://lore.kernel.org/all/69f114ac.050a0220.ac8b.0003.GAE@google.com/
Link: https://patch.msgid.link/20260507112913.1019537-1-dave@stgolabs.net
2026-06-03 22:11:53 +02:00
..
irqflag-debug.c
lock_events.c
lock_events.h
lock_events_list.h
lockdep.c lockdep: Speed up lockdep_unregister_key() with expedited RCU synchronization 2025-07-14 21:57:29 -07:00
lockdep_internals.h locking/lockdep: Change 'static const' variables to enum values 2025-07-14 21:57:29 -07:00
lockdep_proc.c locking/lockdep: Avoid struct return in lock_stats() 2025-07-14 21:57:20 -07:00
lockdep_states.h
locktorture.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
Makefile locking/rwsem: Add context analysis 2026-03-08 11:06:53 +01:00
mcs_spinlock.h
mutex-debug.c Scheduler changes for v7.1: 2026-04-14 13:33:36 -07:00
mutex.c locking/mutex: Fix ww_mutex wait_list operations 2026-04-23 10:05:49 +02:00
mutex.h Scheduler changes for v7.1: 2026-04-14 13:33:36 -07:00
osq_lock.c
percpu-rwsem.c
qrwlock.c
qspinlock.c
qspinlock.h
qspinlock_paravirt.h
qspinlock_stat.h
rtmutex.c locking/rtmutex: Skip remove_waiter() when waiter is not enqueued 2026-06-03 22:11:53 +02:00
rtmutex_api.c locking/rtmutex: Skip remove_waiter() when waiter is not enqueued 2026-06-03 22:11:53 +02:00
rtmutex_common.h locking/rtmutex: Add context analysis 2026-03-08 11:06:53 +01:00
rwbase_rt.c locking/rwsem: Add context analysis 2026-03-08 11:06:53 +01:00
rwsem.c locking/rwsem: Fix logic error in rwsem_del_waiter() 2026-03-16 13:16:48 +01:00
semaphore.c locking/semaphore: Remove the list_head from struct semaphore 2026-03-08 11:06:52 +01:00
spinlock.c locking: Add lock context annotations in the spinlock implementation 2026-03-16 13:16:50 +01:00
spinlock_debug.c locking/spinlock/debug: Fix data-race in do_raw_write_lock 2025-10-21 12:31:55 +02:00
spinlock_rt.c
test-ww_mutex.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ww_mutex.h locking/mutex: Fix ww_mutex wait_list operations 2026-04-23 10:05:49 +02:00
ww_rt_mutex.c locking/rtmutex: Add context analysis 2026-03-08 11:06:53 +01:00