[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMZfGtXoMhji2TeF7gC13DMD4r3md72-CRXFc2BTfwmOx-K=xw@mail.gmail.com>
Date: Tue, 29 Mar 2022 11:01:45 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Marco Elver <elver@...gle.com>
Cc: Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
kasan-dev <kasan-dev@...glegroups.com>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Xiongchun duan <duanxiongchun@...edance.com>
Subject: Re: [External] Re: [PATCH v2] mm: kfence: fix objcgs vector allocation
On Tue, Mar 29, 2022 at 2:58 AM Marco Elver <elver@...gle.com> wrote:
>
> On Mon, 28 Mar 2022 at 17:54, Muchun Song <songmuchun@...edance.com> wrote:
> [...]
> > > >
> > > > 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
>
> Hmm, I would have expected that you have some definitive test case
> that shows the issue, and with the patch the issue is gone. Were there
> issues triggered by syzkaller w/o this patch?
>
I have tested this patch with the following patch and without this patch.
Then we'll see the BUG_ON meaning both objcg vector and object are
allocated from kfence pool.
diff --git a/mm/slab.h b/mm/slab.h
index c7f2abc2b154..1d8d15522a2e 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -519,6 +519,8 @@ static inline void
memcg_slab_post_alloc_hook(struct kmem_cache *s,
continue;
}
+ BUG_ON(is_kfence_address(p[i]) &&
is_kfence_address(slab_objcgs(slab)));
+
off = obj_to_index(s, slab, p[i]);
obj_cgroup_get(objcg);
slab_objcgs(slab)[off] = objcg;
Powered by blists - more mailing lists