[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241021120013.3209481-1-elver@google.com>
Date: Mon, 21 Oct 2024 14:00:10 +0200
From: Marco Elver <elver@...gle.com>
To: elver@...gle.com, Will Deacon <will@...nel.org>
Cc: Andrey Ryabinin <ryabinin.a.a@...il.com>, Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...il.com>, Dmitry Vyukov <dvyukov@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>, Mark Rutland <mark.rutland@....com>,
linux-kernel@...r.kernel.org, kasan-dev@...glegroups.com,
llvm@...ts.linux.dev, syzbot+908886656a02769af987@...kaller.appspotmail.com,
Andrew Pinski <pinskia@...il.com>
Subject: [PATCH 1/2] 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
Tested-by: Andrey Konovalov <andreyknvl@...il.com>
Cc: Andrew Pinski <pinskia@...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
Powered by blists - more mailing lists