kernel_samsung_a53x/kernel/locking
Peter Zijlstra 289a89bfdc lockdep: Fix block chain corruption
[ Upstream commit bca4104b00fec60be330cd32818dd5c70db3d469 ]

Kent reported an occasional KASAN splat in lockdep. Mark then noted:

> I suspect the dodgy access is to chain_block_buckets[-1], which hits the last 4
> bytes of the redzone and gets (incorrectly/misleadingly) attributed to
> nr_large_chain_blocks.

That would mean @size == 0, at which point size_to_bucket() returns -1
and the above happens.

alloc_chain_hlocks() has 'size - req', for the first with the
precondition 'size >= rq', which allows the 0.

This code is trying to split a block, del_chain_block() takes what we
need, and add_chain_block() puts back the remainder, except in the
above case the remainder is 0 sized and things go sideways.

Fixes: 810507fe6fd5 ("locking/lockdep: Reuse freed chain_hlocks entries")
Reported-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Kent Overstreet <kent.overstreet@linux.dev>
Link: https://lkml.kernel.org/r/20231121114126.GH8262@noisy.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 12:10:56 +01:00
..
lock_events.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lock_events.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lock_events_list.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lockdep.c lockdep: Fix block chain corruption 2024-11-18 12:10:56 +01:00
lockdep_internals.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lockdep_proc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lockdep_states.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locktorture.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mcs_spinlock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mutex-debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mutex-debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mutex.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mutex.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
osq_lock.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
percpu-rwsem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qrwlock.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qspinlock.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qspinlock_paravirt.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qspinlock_stat.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtmutex-debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtmutex-debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtmutex.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtmutex.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtmutex_common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rwsem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rwsem.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
semaphore.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
spinlock.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
spinlock_debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
test-ww_mutex.c locking/ww_mutex/test: Fix potential workqueue corruption 2024-11-18 11:43:11 +01:00