diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-17 19:00:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-17 19:00:19 -0500 |
commit | dcc7cd011220d7425a265c9bbf04c5731dacec1b (patch) | |
tree | 4c2244f6e6ce94e2698572e9d2df3baea8449c2a /kernel | |
parent | bf931a01a2c024a54204b4b02276af6e8d99a2c0 (diff) | |
parent | b60e26a2f03d963f8c79ad7920d64abc4d38ecbc (diff) |
Merge branch 'kmemleak' of git://linux-arm.org/linux-2.6
* 'kmemleak' of git://linux-arm.org/linux-2.6:
kmemleak: fix kconfig for crc32 build error
kmemleak: Reduce the false positives by checking for modified objects
kmemleak: Show the age of an unreferenced object
kmemleak: Release the object lock before calling put_object()
kmemleak: Scan the _ftrace_events section in modules
kmemleak: Simplify the kmemleak_scan_area() function prototype
kmemleak: Do not use off-slab management with SLAB_NOLEAKTRACE
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/module.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/module.c b/kernel/module.c index a65dc787a27b..e96b8ed1cb6a 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1910,9 +1910,7 @@ static void kmemleak_load_module(struct module *mod, Elf_Ehdr *hdr, | |||
1910 | unsigned int i; | 1910 | unsigned int i; |
1911 | 1911 | ||
1912 | /* only scan the sections containing data */ | 1912 | /* only scan the sections containing data */ |
1913 | kmemleak_scan_area(mod->module_core, (unsigned long)mod - | 1913 | kmemleak_scan_area(mod, sizeof(struct module), GFP_KERNEL); |
1914 | (unsigned long)mod->module_core, | ||
1915 | sizeof(struct module), GFP_KERNEL); | ||
1916 | 1914 | ||
1917 | for (i = 1; i < hdr->e_shnum; i++) { | 1915 | for (i = 1; i < hdr->e_shnum; i++) { |
1918 | if (!(sechdrs[i].sh_flags & SHF_ALLOC)) | 1916 | if (!(sechdrs[i].sh_flags & SHF_ALLOC)) |
@@ -1921,8 +1919,7 @@ static void kmemleak_load_module(struct module *mod, Elf_Ehdr *hdr, | |||
1921 | && strncmp(secstrings + sechdrs[i].sh_name, ".bss", 4) != 0) | 1919 | && strncmp(secstrings + sechdrs[i].sh_name, ".bss", 4) != 0) |
1922 | continue; | 1920 | continue; |
1923 | 1921 | ||
1924 | kmemleak_scan_area(mod->module_core, sechdrs[i].sh_addr - | 1922 | kmemleak_scan_area((void *)sechdrs[i].sh_addr, |
1925 | (unsigned long)mod->module_core, | ||
1926 | sechdrs[i].sh_size, GFP_KERNEL); | 1923 | sechdrs[i].sh_size, GFP_KERNEL); |
1927 | } | 1924 | } |
1928 | } | 1925 | } |
@@ -2250,6 +2247,12 @@ static noinline struct module *load_module(void __user *umod, | |||
2250 | "_ftrace_events", | 2247 | "_ftrace_events", |
2251 | sizeof(*mod->trace_events), | 2248 | sizeof(*mod->trace_events), |
2252 | &mod->num_trace_events); | 2249 | &mod->num_trace_events); |
2250 | /* | ||
2251 | * This section contains pointers to allocated objects in the trace | ||
2252 | * code and not scanning it leads to false positives. | ||
2253 | */ | ||
2254 | kmemleak_scan_area(mod->trace_events, sizeof(*mod->trace_events) * | ||
2255 | mod->num_trace_events, GFP_KERNEL); | ||
2253 | #endif | 2256 | #endif |
2254 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 2257 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
2255 | /* sechdrs[0].sh_size is always zero */ | 2258 | /* sechdrs[0].sh_size is always zero */ |