Skip to content

Commit 80f5729

Browse files
committed
module: don't annotate ROX memory as kmemleak_not_leak()
jira LE-4694 Rebuild_History Non-Buildable kernel-6.12.0-55.43.1.el10_0 commit-author Mike Rapoport (Microsoft) <rppt@kernel.org> commit 6752047 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: c287c07 ("module: switch to execmem API for remapping as RW and restoring ROX") Fixes: 64f6a4e ("x86: re-enable EXECMEM_ROX support") Reported-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20250214084531.3299390-1-rppt@kernel.org (cherry picked from commit 6752047) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 10d89c0 commit 80f5729

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/module/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,8 @@ static int module_memory_alloc(struct module *mod, enum mod_mem_type type)
12321232
* *do* eventually get freed, but let's just keep things simple
12331233
* and avoid *any* false positives.
12341234
*/
1235-
kmemleak_not_leak(ptr);
1235+
if (!mod->mem[type].is_rox)
1236+
kmemleak_not_leak(ptr);
12361237

12371238
memset(ptr, 0, size);
12381239
mod->mem[type].base = ptr;

0 commit comments

Comments
 (0)