[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0j6p1TSaLo18qQP@feng-clx>
Date: Fri, 14 Oct 2022 13:59:03 +0800
From: Feng Tang <feng.tang@...el.com>
To: Andrey Konovalov <andreyknvl@...il.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Hyeonggon Yoo <42.hyeyoo@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Jonathan Corbet <corbet@....net>,
"Hansen, Dave" <dave.hansen@...el.com>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
kasan-dev <kasan-dev@...glegroups.com>,
"Kees Cook" <keescook@...omium.org>
Subject: Re: [PATCH v6 2/4] mm/slub: only zero the requested size of buffer
for kzalloc
On Thu, Oct 13, 2022 at 10:00:57PM +0800, Andrey Konovalov wrote:
> On Tue, Sep 27, 2022 at 4:42 AM Feng Tang <feng.tang@...el.com> wrote:
> >
> > > > @@ -746,7 +747,7 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s,
> > > > for (i = 0; i < size; i++) {
> > > > p[i] = kasan_slab_alloc(s, p[i], flags, init);
> > > > if (p[i] && init && !kasan_has_integrated_init())
> > > > - memset(p[i], 0, s->object_size);
> > > > + memset(p[i], 0, orig_size);
> > >
> > > Note that when KASAN is enabled and has integrated init, it will
> > > initialize the whole object, which leads to an inconsistency with this
> > > change.
> >
> > Do you mean for kzalloc() only? or there is some kasan check newly added?
>
> Hi Feng,
>
> I mean that when init is true and kasan_has_integrated_init() is true
> (with HW_TAGS mode), kasan_slab_alloc() initializes the whole object.
> Which is inconsistent with the memset() of only orig_size when
> !kasan_has_integrated_init(). But I think this is fine assuming SLAB
> poisoning happens later. But please add a comment.
I see now. Will add some comment. thanks!
- Feng
> Thanks!
Powered by blists - more mailing lists