Re: [PATCH 3/5] kasan, mm: integrate page_alloc init with HW_TAGS

From: Andrey Konovalov
Date: Mon Mar 08 2021 - 09:15:04 EST


On Mon, Mar 8, 2021 at 12:35 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> > - kasan_free_nondeferred_pages(page, order, fpi_flags);
> > + init = want_init_on_free();
> > + if (init && !IS_ENABLED(CONFIG_KASAN_HW_TAGS))
>
> Doing the !IS_ENABLED(CONFIG_KASAN_HW_TAGS) check is awkward, and
> assumes internal knowledge of the KASAN implementation and how all
> current and future architectures that support HW_TAGS work.
>
> Could we instead add a static inline helper to <linux/kasan.h>, e.g.
> kasan_supports_init() or so?
>
> That way, these checks won't grow uncontrollable if a future
> architecture implements HW_TAGS but not init.

Good idea, I'll add a helper in v2.

> Hmm, KASAN certainly "supports" memory initialization always. So maybe
> "kasan_has_accelerated_init()" is more accurate? I leave it to you to
> decide what the best option is.

Let's call it kasan_has_integrated_init().

Thanks!