Re: [2.6.31] Memory leak in load_module()?

Catalin Marinas
2009-09-11T11:17:05Z

On Fri, 2009-09-11 at 19:58 +0900, Tetsuo Handa wrote:
> OK. Here is the output with CONFIG_FRAME_POINTER=y .
> Do I need to enable some other debug options?
>
> unreferenced object 0xdd7c1718 (size 32):
> comm "insmod", pid 2859, jiffies 4294757534
> backtrace:
> [<c048a210>] create_object+0x135/0x202
> [<c048a302>] kmemleak_alloc+0x25/0x49
> [<c04865bd>] kmemleak_alloc_recursive+0x1c/0x22
> [<c0486e27>] __kmalloc_track_caller+0x66/0xb3
> [<c0473980>] kstrdup+0x2c/0x4e
> [<c044716a>] setup_modinfo_srcversion+0x12/0x1b
> [<c0448725>] load_module+0x866/0x124a
> [<c0449180>] sys_init_module+0x49/0x1b9
> [<c0402a24>] sysenter_do_call+0x12/0x22
> [<ffffffff>] 0xffffffff

The object above was allocated by kstrdup via setup_modinfo_srcversion
but the module loading failed and no other kernel part freed the
mod->filed object. I think it's a real leak but you could try a few
"echo scan" to make sure it's not just a temporary false positive.

(the kmemleak branch on git://linux-arm.org/linux-2.6.git has a patch
which dumps the first few bytes from the object and sometimes this
helps; I'll send a pull request to Linus sometime today)

--
Catalin