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.
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?
kernel/module/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/module/main.c b/kernel/module/main.c
index 974821d6e85a..3dbe23098433 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -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;
--
2.47.2