[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wh-mVrp3auBiK2GSMpuqS10Bbq_7fRa6+=zt-0LiF7O2A@mail.gmail.com>
Date: Sun, 27 Mar 2022 14:08:33 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Muchun Song <songmuchun@...edance.com>
Cc: Alexander Potapenko <glider@...gle.com>,
Marco Elver <elver@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Vlastimil Babka <vbabka@...e.cz>, roman.gushchin@...ux.dev,
kasan-dev <kasan-dev@...glegroups.com>,
Linux-MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
syzbot <syzbot+f8c45ccc7d5d45fc5965@...kaller.appspotmail.com>
Subject: Re: [PATCH 1/2] mm: kfence: fix missing objcg housekeeping for SLAB
On Sat, Mar 26, 2022 at 10:19 PM Muchun Song <songmuchun@...edance.com> wrote:
>
> The objcg is not cleared and put for kfence object when it is freed, which
> could lead to memory leak for struct obj_cgroup and wrong statistics of
> NR_SLAB_RECLAIMABLE_B or NR_SLAB_UNRECLAIMABLE_B. Since the last freed
> object's objcg is not cleared, mem_cgroup_from_obj() could return the wrong
> memcg when this kfence object, which is not charged to any objcgs, is
> reallocated to other users. A real word issue [1] is caused by this bug.
Good that this looks sorted out.
Patch 2/2 seems to still be up in the air. The patch not only causes
build errors, but it looks really very odd to me.
In particular, you do that loop with
__SetPageSlab(&pages[i]);
in kfence_init_pool(), but that is *not* where you set the
MEMCG_DATA_OBJCGS, and instead do that virt_to_slab(addr) dance later.
That looks very odd to me. I think the two should go hand-in-hand,
since that __SetPageSlab() really is what makes it a slab thing, and I
think it should go together with setting the slab state correctly.
Finally, is there a syzbot report for that second problem?
Anyway, should I apply this PATCH 1/2 now directly as the solution for
the dentry issue, or should I wait for that second patch? They seem to
be related only indirectly, in that the problems were both introduced
by the same commit.
Linus
Powered by blists - more mailing lists