Re: [PATCH v6 00/19] The new cgroup slab memory controller

From: Roman Gushchin
Date: Sun Jun 21 2020 - 23:08:47 EST


On Sun, Jun 21, 2020 at 07:53:23PM -0400, Qian Cai wrote:
>
>
> > On Jun 21, 2020, at 7:34 PM, Roman Gushchin <guro@xxxxxx> wrote:
> >
> > My wild guess is that kmemleak is getting confused by modifying the lowest
> > bit of page->mem_cgroup/obhj_cgroups pointer:
> >
> > struct page {
> > ...
> > union {
> > struct mem_cgroup *mem_cgroup;
> > struct obj_cgroup **obj_cgroups;
> > };
> > ...
> > }
> >
> > We're using the lowest bit to distinguish between a "normal" mem_cgroup
> > pointer and a vector of obj_cgroup pointers.
> >
> > This pointer to obj_cgroup vector is saved only here, so if we're modifying
> > the address, I guess it's what makes kmemleak think that there is a leak.
> >
> > Or do you have a real leak?
>
> The point is that we canât have a patchset in the current form to totally render kmemleak useless with so many even false positives.
>
> Anyway, this is rather easy to reproduce where I am able to reproduce on multiple bare-metal machines by just booting it.
>
> # echo scan > /sys/kernel/debug/kmemleak
> # cat /sys/kernel/debug/kmemleak

Ok, thank you for the report, I'll take care of it.

It's easy to mark these vectors to be ignored by kmemleak, but I guess it's better
to explicitly add an additional reference, so we can track actual leaks.

I'll send a patch with fix soon-ish.

Thanks!