On Wed, 2013-05-15 at 15:37 +0100, Catalin Marinas wrote: > >From 0621c7e1909ea86bf8499a0ffe5ea59d1007ee8c Mon Sep 17 00:00:00 2001 > From: Catalin Marinas <[email protected]> > Date: Wed, 15 May 2013 15:30:46 +0100 > Subject: [PATCH] kmemleak: Scan the jump label module section > > Objects allocated in jump_label_add_module() are currently reported as > leaks, though the pointers are stored in the module jump label section. > This patch informs kmemleak that this section needs to be scanned. > > Signed-off-by: Catalin Marinas <[email protected]> > Reported-by: Steven Rostedt <[email protected]>
This didn't work. I still get the leak messages. But this change did: Instead of just picking data sections by name (names that start with .data, .bss or .ref.data), use the section flags and scan all sections that are allocated, writable and not executable. Which should cover all sections of a module that might reference data. Signed-off-by: Steven Rostedt <[email protected]> Index: linux-trace.git/kernel/module.c =================================================================== --- linux-trace.git.orig/kernel/module.c +++ linux-trace.git/kernel/module.c @@ -2432,10 +2432,12 @@ static void kmemleak_load_module(const s for (i = 1; i < info->hdr->e_shnum; i++) { const char *name = info->secstrings + info->sechdrs[i].sh_name; - if (!(info->sechdrs[i].sh_flags & SHF_ALLOC)) + + /* Scan all writable sections that's not executable */ + if (!(info->sechdrs[i].sh_flags & SHF_ALLOC) || + !(info->sechdrs[i].sh_flags & SHF_WRITE)) continue; - if (!strstarts(name, ".data") && !strstarts(name, ".bss") && - !strstarts(name, ".ref.data")) + if (info->sechdrs[i].sh_flags & SHF_EXECINSTR) continue; kmemleak_scan_area((void *)info->sechdrs[i].sh_addr, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

