summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBreno Leitao <leitao@debian.org>2026-07-03 08:22:03 -0700
committerAndrew Morton <akpm@linux-foundation.org>2026-07-26 22:48:56 -0700
commit338d4fc4a05a71d37da65ab344e130c56c35840e (patch)
tree791be6c29563762ecd10dd6c2d86c8d5b020a20d /tools
parent1b81214990d3ba872a3f26c8289ada800dbb2d4b (diff)
downloadlinux-next-338d4fc4a05a71d37da65ab344e130c56c35840e.tar.gz
linux-next-338d4fc4a05a71d37da65ab344e130c56c35840e.zip
radix-tree: fix kmemleak false positives on tree head reassignment
Kmemleak periodically reports transient false positives for radix tree nodes allocated through the IDR, for example: unreferenced object 0xffff0004d6ac4200 (size 576): comm "tcpeventd", pid 6412 backtrace (crc 335d668a): kmem_cache_alloc_noprof radix_tree_node_alloc radix_tree_extend idr_get_free idr_alloc_cyclic map_create __sys_bpf radix_tree_extend() (grow) and radix_tree_shrink() (shrink) repoint root->xa_head to a new node. If a kmemleak scan has already walked past root->xa_head, the new head is not reachable from any scanned pointer until the following scan, so kmemleak reports it as leaked even though it is live. This is the same race fixed for the XArray API in commit a1a029bcea59 ("XArray: fix kmemleak false positive in xas_shrink()"). The IDR uses the radix tree API directly and hits it on both the grow and the shrink path, so mark the new head as a transient leak in both. Add a matching kmemleak_transient_leak() stub to the radix tree test harness so the userspace lib/radix-tree.c build keeps building. Link: https://lore.kernel.org/20260703-radix-tree-v2-1-38bb6efb5f6e@debian.org Signed-off-by: Breno Leitao <leitao@debian.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Kent Overstreet <kent.overstreet@linux.dev> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/shared/linux/kmemleak.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/shared/linux/kmemleak.h b/tools/testing/shared/linux/kmemleak.h
index 155f112786c4..65a383090fb5 100644
--- a/tools/testing/shared/linux/kmemleak.h
+++ b/tools/testing/shared/linux/kmemleak.h
@@ -1 +1,2 @@
static inline void kmemleak_update_trace(const void *ptr) { }
+static inline void kmemleak_transient_leak(const void *ptr) { }