Commit 67520477 authored by Mike Rapoport (Microsoft)'s avatar Mike Rapoport (Microsoft) Committed by Peter Zijlstra
Browse files

module: don't annotate ROX memory as kmemleak_not_leak()



The ROX memory allocations are part of a larger vmalloc allocation and
annotating them with kmemleak_not_leak() confuses kmemleak.

Skip kmemleak_not_leak() annotations for the ROX areas.

Fixes: c287c072 ("module: switch to execmem API for remapping as RW and restoring ROX")
Fixes: 64f6a4e1 ("x86: re-enable EXECMEM_ROX support")
Reported-by: default avatar"Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
Signed-off-by: default avatarMike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250214084531.3299390-1-rppt@kernel.org
parent 63887c9f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1260,6 +1260,7 @@ static int module_memory_alloc(struct module *mod, enum mod_mem_type type)
	 * *do* eventually get freed, but let's just keep things simple
	 * and avoid *any* false positives.
	 */
	if (!mod->mem[type].is_rox)
		kmemleak_not_leak(ptr);

	memset(ptr, 0, size);