linux/mm/kasan
Andrey Konovalov cc478e0b6b kasan: avoid resetting aux_lock
With commit 63b85ac56a ("kasan: stop leaking stack trace handles"),
KASAN zeroes out alloc meta when an object is freed.  The zeroed out data
purposefully includes alloc and auxiliary stack traces but also
accidentally includes aux_lock.

As aux_lock is only initialized for each object slot during slab creation,
when the freed slot is reallocated, saving auxiliary stack traces for the
new object leads to lockdep reports when taking the zeroed out aux_lock.

Arguably, we could reinitialize aux_lock when the object is reallocated,
but a simpler solution is to avoid zeroing out aux_lock when an object
gets freed.

Link: https://lkml.kernel.org/r/20240109221234.90929-1-andrey.konovalov@linux.dev
Fixes: 63b85ac56a ("kasan: stop leaking stack trace handles")
Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
Reported-by: Paul E. McKenney <paulmck@kernel.org>
Closes: https://lore.kernel.org/linux-next/5cc0f83c-e1d6-45c5-be89-9b86746fe731@paulmck-laptop/
Reviewed-by: Marco Elver <elver@google.com>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-01-12 15:20:45 -08:00
..
common.c Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
generic.c kasan: avoid resetting aux_lock 2024-01-12 15:20:45 -08:00
hw_tags.c kasan: check kasan_vmalloc_enabled in vmalloc tests 2023-12-29 11:58:45 -08:00
init.c kasan: Add (pmd|pud)_init for LoongArch zero_(pud|p4d)_populate process 2023-09-06 22:54:16 +08:00
kasan_test_module.c kasan: unify printk prefixes 2023-10-18 14:34:15 -07:00
kasan_test.c kasan: speed up match_all_mem_tag test for SW_TAGS 2023-12-29 11:58:46 -08:00
kasan.h Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
Makefile kasan: test: fix test for new meminstrinsic instrumentation 2023-03-02 21:54:22 -08:00
quarantine.c Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
report_generic.c kasan: stop leaking stack trace handles 2024-01-05 10:17:45 -08:00
report_hw_tags.c kasan: use internal prototypes matching gcc-13 builtins 2023-06-09 16:25:19 -07:00
report_sw_tags.c kasan: use internal prototypes matching gcc-13 builtins 2023-06-09 16:25:19 -07:00
report_tags.c kasan: simplify kasan_complete_mode_report_info for tag-based modes 2023-12-29 11:58:47 -08:00
report.c Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
shadow.c kasan: export kasan_poison as GPL 2023-12-29 11:58:45 -08:00
sw_tags.c kasan: use internal prototypes matching gcc-13 builtins 2023-06-09 16:25:19 -07:00
tags.c kasan: simplify saving extra info into tracks 2023-12-29 11:58:46 -08:00