[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+fCnZc4iNa_bxo8mj52Dm8RCKAW=DQ_KUSKK2+OzjmF3T+tRw@mail.gmail.com>
Date: Fri, 18 Oct 2024 22:25:15 +0200
From: Andrey Konovalov <andreyknvl@...il.com>
To: Marco Elver <elver@...gle.com>
Cc: Will Deacon <will@...nel.org>, linux-arm-kernel@...ts.infradead.org,
catalin.marinas@....com, kernel-team@...roid.com,
linux-kernel@...r.kernel.org, ryabinin.a.a@...il.com, glider@...gle.com,
kasan-dev@...glegroups.com, Mark Rutland <mark.rutland@....com>,
syzbot+908886656a02769af987@...kaller.appspotmail.com,
Andrew Pinski <pinskia@...il.com>
Subject: Re: [PATCH] kasan: Disable Software Tag-Based KASAN with GCC
On Fri, Oct 18, 2024 at 10:37 AM Marco Elver <elver@...gle.com> wrote:
>
> > Applied to arm64 (for-next/fixes), thanks!
> >
> > [1/1] kasan: Disable Software Tag-Based KASAN with GCC
> > https://git.kernel.org/arm64/c/7aed6a2c51ff
>
> I do not think this is the right fix. Please see alternative below.
> Please do double-check that the observed splat above is fixed with that.
>
> Thanks,
> -- Marco
>
> ------ >8 ------
>
> From 23bd83dbff5a9778f34831ed292d5e52b4b0ee18 Mon Sep 17 00:00:00 2001
> From: Marco Elver <elver@...gle.com>
> Date: Fri, 18 Oct 2024 10:18:24 +0200
> Subject: [PATCH] kasan: Fix Software Tag-Based KASAN with GCC
>
> Per [1], -fsanitize=kernel-hwaddress with GCC currently does not disable
> instrumentation in functions with __attribute__((no_sanitize_address)).
>
> However, __attribute__((no_sanitize("hwaddress"))) does correctly
> disable instrumentation. Use it instead.
>
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117196 [1]
> Link: https://lore.kernel.org/r/000000000000f362e80620e27859@google.com
> Link: https://lore.kernel.org/r/ZvFGwKfoC4yVjN_X@J2N7QTR9R3
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=218854
> Reported-by: syzbot+908886656a02769af987@...kaller.appspotmail.com
> Cc: Andrew Pinski <pinskia@...il.com>
> Cc: Andrey Konovalov <andreyknvl@...il.com>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: Will Deacon <will@...nel.org>
> Signed-off-by: Marco Elver <elver@...gle.com>
> ---
> include/linux/compiler-gcc.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index f805adaa316e..cd6f9aae311f 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -80,7 +80,11 @@
> #define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
> #endif
>
> +#ifdef __SANITIZE_HWADDRESS__
> +#define __no_sanitize_address __attribute__((__no_sanitize__("hwaddress")))
> +#else
> #define __no_sanitize_address __attribute__((__no_sanitize_address__))
> +#endif
>
> #if defined(__SANITIZE_THREAD__)
> #define __no_sanitize_thread __attribute__((__no_sanitize_thread__))
> --
> 2.47.0.rc1.288.g06298d1525-goog
Tested the change, it does fix the boot-time issue #1 from [1], but #2
and #3 still exist.
However, perhaps, just fixing #1 is already good enough to do a revert
of the Will's patch - at least the kernel will boot without
false-positive reports.
But I would keep a note that SW_TAGS doesn't work well with GCC until
[1] is fully resolved.
Thanks!
[1] https://bugzilla.kernel.org/show_bug.cgi?id=218854
Powered by blists - more mailing lists