Re: [PATCH v2 03/21] KASAN: remove code paths guarded by CONFIG_SLAB

Hyeonggon Yoo
2023-11-21T08:23:29Z

On Tue, Nov 21, 2023 at 3:34 AM Vlastimil Babka <vbabka@suse.cz> wrote:
>
> With SLAB removed and SLUB the only remaining allocator, we can clean up
> some code that was depending on the choice.
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Marco Elver <elver@google.com>
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---

[...]

> diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c
> index ca4529156735..138c57b836f2 100644
> --- a/mm/kasan/quarantine.c
> +++ b/mm/kasan/quarantine.c
> @@ -144,10 +144,6 @@ static void qlink_free(struct qlist_node *qlink, struct kmem_cache *cache)
> {
> void *object = qlink_to_object(qlink, cache);
> struct kasan_free_meta *meta = kasan_get_free_meta(cache, object);
> - unsigned long flags;
> -
> - if (IS_ENABLED(CONFIG_SLAB))
> - local_irq_save(flags);
>
> /*
> * If init_on_free is enabled and KASAN's free metadata is stored in
> @@ -166,9 +162,6 @@ static void qlink_free(struct qlist_node *qlink, struct kmem_cache *cache)
> *(u8 *)kasan_mem_to_shadow(object) = KASAN_SLAB_FREE;
>
> ___cache_free(cache, object, _THIS_IP_);
> -
> - if (IS_ENABLED(CONFIG_SLAB))
> - local_irq_restore(flags);
> }

FYI there's a slight conflict (easy to resolve, though) when I tried
to merge this on top of linux-next,
due to a recent change in KASAN:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=0e8b630f3053f0ff84b7c3ab8ff98a7393863824

Thanks,
Hyeonggon