aboutsummaryrefslogtreecommitdiff
path: root/kernel/module.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2013-05-15 20:33:01 +0100
committerCatalin Marinas <catalin.marinas@arm.com>2013-05-17 09:53:07 +0100
commit06c9494c0e9bdfcaa14d6d2b096a0ff7abe8494f (patch)
tree22da52e773d30408d0372eeb20f18821d2834cca /kernel/module.c
parentf722406faae2d073cc1d01063d1123c35425939e (diff)
downloadlinaro-lsk-06c9494c0e9bdfcaa14d6d2b096a0ff7abe8494f.tar.gz
kmemleak: Scan all allocated, writeable and not executable module sections
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 <rostedt@goodmis.org> [catalin.marinas@arm.com: removed unused 'name' variable] [catalin.marinas@arm.com: collapsed 'if' blocks] Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/module.c b/kernel/module.c
index b049939177f..06f496a5d18 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2431,10 +2431,10 @@ static void kmemleak_load_module(const struct module *mod,
kmemleak_scan_area(mod, sizeof(struct module), GFP_KERNEL);
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))
- continue;
- if (!strstarts(name, ".data") && !strstarts(name, ".bss"))
+ /* Scan all writable sections that's not executable */
+ if (!(info->sechdrs[i].sh_flags & SHF_ALLOC) ||
+ !(info->sechdrs[i].sh_flags & SHF_WRITE) ||
+ (info->sechdrs[i].sh_flags & SHF_EXECINSTR))
continue;
kmemleak_scan_area((void *)info->sechdrs[i].sh_addr,