From: Marco Elver <elver@google.com>
To: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com,
kernel-team@android.com, linux-kernel@vger.kernel.org,
ryabinin.a.a@gmail.com, glider@google.com,
kasan-dev@googlegroups.com,
Andrey Konovalov <andreyknvl@gmail.com>,
Mark Rutland <mark.rutland@arm.com>,
syzbot+908886656a02769af987@syzkaller.appspotmail.com,
Andrew Pinski <pinskia@gmail.com>
Subject: Re: [PATCH] kasan: Disable Software Tag-Based KASAN with GCC
Date: Fri, 18 Oct 2024 10:37:41 +0200 [thread overview]
Message-ID: <ZxIeVabQQS2aISe5@elver.google.com> (raw)
In-Reply-To: <172898869113.658437.16326042568646594201.b4-ty@kernel.org>
On Tue, Oct 15, 2024 at 01:39PM +0100, 'Will Deacon' via kasan-dev wrote:
> On Mon, 14 Oct 2024 17:11:00 +0100, Will Deacon wrote:
> > Syzbot reports a KASAN failure early during boot on arm64 when building
> > with GCC 12.2.0 and using the Software Tag-Based KASAN mode:
> >
> > | BUG: KASAN: invalid-access in smp_build_mpidr_hash arch/arm64/kernel/setup.c:133 [inline]
> > | BUG: KASAN: invalid-access in setup_arch+0x984/0xd60 arch/arm64/kernel/setup.c:356
> > | Write of size 4 at addr 03ff800086867e00 by task swapper/0
> > | Pointer tag: [03], memory tag: [fe]
> >
> > [...]
>
> 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@google.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@syzkaller.appspotmail.com
Cc: Andrew Pinski <pinskia@gmail.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Marco Elver <elver@google.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
next prev parent reply other threads:[~2024-10-18 8:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 16:11 [PATCH] kasan: Disable Software Tag-Based KASAN with GCC Will Deacon
2024-10-14 16:25 ` Mark Rutland
2024-10-14 18:30 ` Andrey Konovalov
2024-10-15 12:39 ` Will Deacon
2024-10-18 8:37 ` Marco Elver [this message]
2024-10-18 20:25 ` Andrey Konovalov
2024-10-18 20:30 ` Marco Elver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZxIeVabQQS2aISe5@elver.google.com \
--to=elver@google.com \
--cc=andreyknvl@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=kernel-team@android.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pinskia@gmail.com \
--cc=ryabinin.a.a@gmail.com \
--cc=syzbot+908886656a02769af987@syzkaller.appspotmail.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).