[PATCH mm v3 17/19] kasan: clean up metadata allocation and usage

Andrey Konovalov andreyknvl at google.com
Mon Nov 23 14:16:04 EST 2020


On Mon, Nov 23, 2020 at 7:54 PM Andrey Konovalov <andreyknvl at google.com> wrote:
>
> > > @@ -168,6 +173,9 @@ void quarantine_put(struct kmem_cache *cache, void *object)
> > >         struct qlist_head temp = QLIST_INIT;
> > >         struct kasan_free_meta *meta = kasan_get_free_meta(cache, object);
> > >
> > > +       if (!meta)
> > > +               return;
> >
> > Humm... is this possible? If yes, we would be leaking the object here...
> > Perhaps BUG_ON with a comment instead.
>
> No, this isn't possible. Will turn this into a warning and add a comment.

Actually, looking as this some more, looks like with this change this
becomes possible. I think the best approach here is to not put such
objects into quarantine, and return proper value from
____kasan_slab_free() to avoid a leak. I'll fix this in the next
version.

Thanks!



More information about the linux-arm-kernel mailing list