Message ID | 20250214084531.3299390-1-rppt@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | module: don't annotate ROX memory as kmemleak_not_leak() | expand |
Context | Check | Description |
---|---|---|
mcgrof/vmtest-modules-next-VM_Test-0 | success | Logs for Run CI tests |
mcgrof/vmtest-modules-next-VM_Test-1 | success | Logs for Run CI tests |
mcgrof/vmtest-modules-next-VM_Test-4 | fail | Logs for setup / Setup kdevops environment |
mcgrof/vmtest-modules-next-VM_Test-5 | fail | Logs for setup / Setup kdevops environment |
mcgrof/vmtest-modules-next-PR | fail | PR summary |
mcgrof/vmtest-modules-next-VM_Test-3 | fail | Logs for cleanup / Archive results and cleanup |
mcgrof/vmtest-modules-next-VM_Test-2 | fail | Logs for cleanup / Archive results and cleanup |
On Fri, Feb 14, 2025 at 10:45:31AM +0200, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" <rppt@kernel.org> > > 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" <chaitanya.kumar.borah@intel.com> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> > --- > > 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!
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;