module: don't annotate ROX memory as kmemleak_not_leak()
PATCH 1/1 module: don't annotate ROX memory as kmemleak_not_leak()
From: "Mike Rapoport (Microsoft)" <[email protected]>
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.
---
Peter, can you take it via tip tree?
Or you prefer for Luis to pick this up?
kernel/module/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/module/main.c +2 -1
@@ -1250,7 +1250,8 @@ 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. */ -kmemleak_not_leak (ptr); +if (!mod->mem[type].is_rox) +kmemleak_not_leak (ptr);memset (ptr,0 , size); mod->mem[type].base = ptr;
Signature · 1 line
2.47.2
Quoted 7 lines · Mike Rapoport
From: "Mike Rapoport (Microsoft)" <[email protected]>
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.
Quoted 8 lines
Fixes c287c0723329 ("module: switch to execmem API for remapping as RW and restoring ROX")Fixes 64f6a4e10c05 ("x86: re-enable EXECMEM_ROX support")Reported-by "Borah, Chaitanya Kumar" <[email protected]>Signed-off-by Mike Rapoport (Microsoft) <[email protected]>---
Peter, can you take it via tip tree?
Or you prefer for Luis to pick this up?
Less of a head-ache overall if these things stay together I recon. So I'll stick it in tip/x86/mm along with the rest of those patches.
Thanks!
The following commit has been merged into the x86/core branch of tip:
The following commit has been merged into the x86/core branch of tip:
Commit-ID: 675204778c69c2b3e0f6a4e2dbfeb4f3e89194ba Gitweb: https://git.kernel.org/tip/675204778c69c2b3e0f6a4e2dbfeb4f3e89194ba Author: Mike Rapoport (Microsoft) <[email protected]> AuthorDate: Fri, 14 Feb 2025 10:45:31 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 14 Feb 2025 10:32:02 +01:00
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.
--- kernel/module/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/module/main.c +2 -1
@@ -1260,7 +1260,8 @@ 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. */ -kmemleak_not_leak (ptr); +if (!mod->mem[type].is_rox) +kmemleak_not_leak (ptr);memset (ptr,0 , size); mod->mem[type].base = ptr;