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

Marco Elver elver at google.com
Tue Nov 17 08:18:32 EST 2020


On Tue, 17 Nov 2020 at 14:12, Dmitry Vyukov <dvyukov at google.com> wrote:

> > +        */
> >         *(u8 *)kasan_mem_to_shadow(object) = KASAN_KMALLOC_FREE;
> > +
> >         ___cache_free(cache, object, _THIS_IP_);
> >
> >         if (IS_ENABLED(CONFIG_SLAB))
> > @@ -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.

If this is possible in prod-mode KASAN, a WARN_ON() that returns would be safer.



More information about the linux-arm-kernel mailing list