Re: [PATCH v6 3/4] mm: kasan: Add free_meta size info in struct kasan_cache

From: Feng Tang
Date: Mon Sep 26 2022 - 23:11:43 EST


On Mon, Sep 26, 2022 at 12:31:37AM +0800, Andrey Konovalov wrote:
> On Sun, Sep 25, 2022 at 1:27 PM Feng Tang <feng.tang@xxxxxxxxx> wrote:
> >
> > > [1] https://lore.kernel.org/linux-mm/c7b316d30d90e5947eb8280f4dc78856a49298cf.1662411799.git.andreyknvl@xxxxxxxxxx/
> >
> > I noticed this has been merged to -mm tree's 'mm-everything' branch,
> > so following is the patch againt that. Thanks!
> >
> > One thing I'm not very sure is, to check 'in-object' kasan's meta
> > size, I didn't check 'alloc_meta_offset', as from the code reading
> > the alloc_meta is never put inside slab object data area.
>
> Yes, this is correct.
>
> > @@ -1042,7 +1042,7 @@ static int check_pad_bytes(struct kmem_cache *s, struct slab *slab, u8 *p)
> > /* We also have user information there */
> > off += 2 * sizeof(struct track);
> >
> > - off += kasan_metadata_size(s);
> > + off += kasan_metadata_size(s, false);
> >
> > if (size_from_object(s) == off)
> > return 1;
>
> Reviewed-by: Andrey Konovalov <andreyknvl@xxxxxxxxx>

Thank you!

I made a formal patch, which is based on your latest kasan patchset
in -mm tree

Thanks,
Feng

---