Re: [PATCH v12 05/25] kasan: add CONFIG_KASAN_GENERIC and CONFIG_KASAN_SW_TAGS

From: Max Filippov
Date: Tue Dec 04 2018 - 17:24:03 EST


Hello,

On Tue, Nov 27, 2018 at 9:00 AM Andrey Konovalov <andreyknvl@xxxxxxxxxx> wrote:
>
> This commit splits the current CONFIG_KASAN config option into two:
> 1. CONFIG_KASAN_GENERIC, that enables the generic KASAN mode (the one
> that exists now);
> 2. CONFIG_KASAN_SW_TAGS, that enables the software tag-based KASAN mode.

[...]

> --- a/lib/Kconfig.kasan
> +++ b/lib/Kconfig.kasan
> @@ -1,35 +1,95 @@
> +# This config refers to the generic KASAN mode.
> config HAVE_ARCH_KASAN
> bool
>
> +config HAVE_ARCH_KASAN_SW_TAGS
> + bool
> +
> +config CC_HAS_KASAN_GENERIC
> + def_bool $(cc-option, -fsanitize=kernel-address)
> +
> +config CC_HAS_KASAN_SW_TAGS
> + def_bool $(cc-option, -fsanitize=kernel-hwaddress)
> +
> if HAVE_ARCH_KASAN
>
> config KASAN
> - bool "KASan: runtime memory debugger"
> + bool "KASAN: runtime memory debugger"
> + help
> + Enables KASAN (KernelAddressSANitizer) - runtime memory debugger,
> + designed to find out-of-bounds accesses and use-after-free bugs.
> + See Documentation/dev-tools/kasan.rst for details.

Perhaps KASAN should depend on
CC_HAS_KASAN_GENERIC || CC_HAS_KASAN_SW_TAGS,
otherwise make all*config may enable KASAN
for a compiler that does not have any -fsanitize=kernel-*address
support, resulting in build failures like this:
http://kisskb.ellerman.id.au/kisskb/buildresult/13606170/log/

--
Thanks.
-- Max