Re: [PATCH v2] mm: kfence: fix objcgs vector allocation

From: Muchun Song
Date: Mon Mar 28 2022 - 11:54:52 EST


On Mon, Mar 28, 2022 at 11:51 PM Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote:
>
> On Mon, Mar 28, 2022 at 11:43 PM Marco Elver <elver@xxxxxxxxxx> wrote:
> >
> > On Mon, 28 Mar 2022 at 15:28, Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote:
> > >
> > > If the kfence object is allocated to be used for objects vector, then
> > > this slot of the pool eventually being occupied permanently since
> > > the vector is never freed. The solutions could be 1) freeing vector
> > > when the kfence object is freed or 2) allocating all vectors statically.
> > > Since the memory consumption of object vectors is low, it is better to
> > > chose 2) to fix the issue and it is also can reduce overhead of vectors
> > > allocating in the future.
> > >
> > > Fixes: d3fb45f370d9 ("mm, kfence: insert KFENCE hooks for SLAB")
> > > Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> >
> > Reviewed-by: Marco Elver <elver@xxxxxxxxxx>
>
> Thanks.
>
> >
> > Btw, how did you test this?
> >

I have tested it with syzkaller with the following configs.
And I didn't find any issues.

CONFIG_KFENCE=y
CONFIG_KFENCE_SAMPLE_INTERVAL=10
CONFIG_KFENCE_NUM_OBJECTS=2550
CONFIG_KFENCE_DEFERRABLE=n
CONFIG_KFENCE_STATIC_KEYS=y
CONFIG_KFENCE_STRESS_TEST_FAULTS=0