[PATCH 3/3] mm/vmalloc: skip vmalloc_dump_obj for non-vmalloc addresses
From: Ye Liu
Date: Wed Sep 16 2026 - 04:29:41 EST
From: Ye Liu <liuye@xxxxxxxxxx>
vmalloc_dump_obj() unconditionally searches all vmap nodes even when
called with a non-vmalloc address (e.g. a slab or stack pointer from
mem_dump_obj()). Add an is_vmalloc_addr() check at the entry to
avoid the unnecessary per-node trylock and rb-tree traversal.
The KASAN caller already gates on is_vmalloc_addr(), but mem_dump_obj()
calls vmalloc_dump_obj() before the fallback type check, so the guard
in the callee covers both paths without requiring caller changes.
Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
---
mm/vmalloc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 30c610f678dc..b3e706fde202 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -5277,6 +5277,9 @@ bool vmalloc_dump_obj(void *object)
unsigned long addr;
unsigned long nr_pages;
+ if (!is_vmalloc_addr(object))
+ return false;
+
addr = PAGE_ALIGN_DOWN((unsigned long) object);
/*
--
2.25.1