On Thu, Oct 28, 2010 at 1:54 PM, Catalin Marinas <[email protected]> wrote: > On Wed, 2010-10-27 at 20:24 +0100, Sankar P wrote: >> Now I removed the "static __init" from the hello_init function and I >> got an output of: >> >> unreferenced object 0xf9042000 (size 512): >> comm "insmod", pid 12068, jiffies 13995923 (age 51.096s) >> hex dump (first 32 bytes): >> 6f 64 75 6c 65 00 00 00 00 00 00 2e 73 79 6d 74 odule.......symt >> 61 62 00 2e 73 74 72 74 61 62 00 2e 73 68 73 74 ab..strtab..shst >> backtrace: >> [<c10b0001>] create_object+0x114/0x1db >> [<c148b4d0>] kmemleak_alloc+0x21/0x3f >> [<c10a43e9>] __vmalloc_node+0x83/0x90 >> [<c10a44b9>] vmalloc+0x1c/0x1e >> [<f9036021>] init_module+0x21/0x2f [hello_kernel] >> [<c1001226>] do_one_initcall+0x71/0x113 >> [<c1056c48>] sys_init_module+0x1241/0x1430 >> [<c100284c>] sysenter_do_call+0x12/0x22 >> [<ffffffff>] 0xffffffff > > That's because once a module was initialised, the __init functions and > ksym entries are removed from the module, to save space. When a memory > allocation takes place, kmemleak stores the backtrace as pointers to > code. When reporting a leak, it does the ksym look-up to match the > address against a function name.
FWIW, I made a blog post explaining my experience, so that if someone googles in future for linux kernel memory leak detection, it might help them. thank you all. http://psankar.blogspot.com/2010/11/detecting-memory-leaks-in-kernel.html Sankar -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to [email protected] Please read the FAQ at http://kernelnewbies.org/FAQ
