mm, kasan: stackdepot implementation. Enable stackdepot for SLAB
Implement the stack depot and provide CONFIG_STACKDEPOT. Stack depot
will allow KASAN store allocation/deallocation stack traces for memory
chunks. The stack traces are stored in a hash table and referenced by
handles which reside in the kasan_alloc_meta and kasan_free_meta
structures in the allocated memory chunks.
IRQ stack traces are cut below the IRQ entry point to avoid unnecessary
Right now stackdepot support is only enabled in SLAB allocator. Once
KASAN features in SLAB are on par with those in SLUB we can switch SLUB
to stackdepot as well, thus removing the dependency on SLUB stack
bookkeeping, which wastes a lot of memory.
This patch is based on the "mm: kasan: stack depots" patch originally
prepared by Dmitry Chernenkov.
Joonsoo has said that he plans to reuse the stackdepot code for the
mm/page_owner.c debugging facility.
[email@example.com: comment style fixes]
Signed-off-by: Alexander Potapenko <firstname.lastname@example.org>
Signed-off-by: Andrey Ryabinin <email@example.com>
Cc: Christoph Lameter <firstname.lastname@example.org>
Cc: Pekka Enberg <email@example.com>
Cc: David Rientjes <firstname.lastname@example.org>
Cc: Joonsoo Kim <email@example.com>
Cc: Andrey Konovalov <firstname.lastname@example.org>
Cc: Dmitry Vyukov <email@example.com>
Cc: Steven Rostedt <firstname.lastname@example.org>
Cc: Konstantin Serebryany <email@example.com>
Cc: Dmitry Chernenkov <firstname.lastname@example.org>
Signed-off-by: Andrew Morton <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
9 files changed