https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96307

--- Comment #12 from Kito Cheng <kito at gcc dot gnu.org> ---
> This disables the CC_HAS_KASAN_GENERIC config of the kernel, making KASAN 
> unavailable.

Hmmmm, I checked with kernel source code, it only feed
-fsanitize=kernel-address during checking, but in fact it must work with
-fasan-shadow-offset=, and it does actually, what do you think about fix that
on kernel side?

diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index fba9909e31b7..9a2484132b2d 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -13,7 +13,7 @@ config HAVE_ARCH_KASAN_VMALLOC
        bool

 config CC_HAS_KASAN_GENERIC
-       def_bool $(cc-option, -fsanitize=kernel-address)
+       def_bool $(cc-option, -fsanitize=kernel-address
-fasan-shadow-offset=0x1)

 config CC_HAS_KASAN_SW_TAGS
        def_bool $(cc-option, -fsanitize=kernel-hwaddress)


> Also, the warning text doesn't make sense:
>
> $ gcc -fsanitize=kernel-address -S -xc /dev/null -o /dev/null
> cc1: warning: ‘-fsanitize=kernel-address’ with stack protection is not 
> supported without ‘-fasan-shadow-offset=’ for this target

That's my fault I didn't update the error message there, that error message was
introduced when fixing PR96260, but during fix this PR.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96260

Reply via email to