Re: kmemleak false positive?

Catalin Marinas
2009-06-25T17:00:26Z

On Thu, 2009-06-25 at 11:40 -0400, Dave Jones wrote:
> Here's another case (with stack scanning on btw) which looks odd..
>
> kmemleak: unreferenced object 0xd86ba000 (size 16):
> kmemleak: comm "init", pid 1, jiffies 4294683556
> kmemleak: backtrace:
> kmemleak: [<c04fd8b3>] kmemleak_alloc+0x193/0x2b8
> kmemleak: [<c04f5e73>] kmem_cache_alloc+0x11e/0x174
> kmemleak: [<c05cdfdc>] avtab_insertf+0xd6/0x140
> kmemleak: [<c05ce3d7>] avtab_read_item+0x26a/0x284
> kmemleak: [<c05ce5a5>] avtab_read+0x82/0xe5
> kmemleak: [<c05d0618>] policydb_read+0x40c/0x1028
> kmemleak: [<c05d459d>] security_load_policy+0x57/0x37c
> kmemleak: [<c05c9995>] sel_write_load+0xb2/0x54a
> kmemleak: [<c0500186>] vfs_write+0x9f/0x10f
> kmemleak: [<c05002e1>] sys_write+0x58/0x8d
> kmemleak: [<c040a8eb>] sysenter_do_call+0x12/0x38
> kmemleak: [<ffffffff>] 0xffffffff
>
> I looked over the SELinux code, and couldn't see an obvious leak.
> Eric Paris came to the same conclusion.

How long does a memory scanning take (i.e. time cat debug/kmemleak) on
your platform? Another tweak is to increase MSECS_MIN_AGE to something
like 1 minute or more. Especially on SMP, some newly allocated objects
may be in registers and reported as leaks.

I'll have a look at the initial colour assigned to newly allocated
objects. Currently the objects allocated during a scan have no colour so
that they are not reported. However, they are not scanned either so
other object pointers allocated before the scan started may be stored in
those new objects.

--
Catalin