Bug 216306 - KASAN: print alloc stacks in kmem_cache_destroy() for leaked objects
Summary: KASAN: print alloc stacks in kmem_cache_destroy() for leaked objects
Status: NEW
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Sanitizers (show other bugs)
Hardware: All Linux
: P1 enhancement
Assignee: MM/Sanitizers virtual assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-29 12:30 UTC by Dmitry Vyukov
Modified: 2022-07-29 12:39 UTC (History)
1 user (show)

See Also:
Kernel Version: ALL
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Dmitry Vyukov 2022-07-29 12:30:36 UTC
There is a WARNING in kmem_cache_destroy() for the cases when a cache is destroyed with live objects:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/slab_common.c?id=e0dccc3b76fb35bb257b4118367a883073d7390e#n506

When KASAN is enabled we could print allocation stacks for all leaked objects to give more useful info for debugging.

For context see:
https://lore.kernel.org/all/2916828.W3qMjvkFlE@silver/
Comment 1 Dmitry Vyukov 2022-07-29 12:39:49 UTC
Allocation stacks may always be the same for custom caches, but they may also be different. E.g. in this case the allocation happens in a common p9_client_prepare_req() function that it called in multiple places.
But KASAN can also provide "aux" stacks that may also give some glues.

Note You need to log in before you can comment on or make changes to this bug.