summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2024-10-21 14:00:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-08 16:28:20 +0100
commit2e4eb1866990ecf88d7f71163f99b1940baa9130 (patch)
tree3968266e7826ef9058a38b719125abaa5df60c7f /include
parent4c3575787e988f2a7d1e1b402e5a2fdbafce86c2 (diff)
downloadlinux-rpi-2e4eb1866990ecf88d7f71163f99b1940baa9130.tar.gz
linux-rpi-2e4eb1866990ecf88d7f71163f99b1940baa9130.tar.bz2
linux-rpi-2e4eb1866990ecf88d7f71163f99b1940baa9130.zip
kasan: Fix Software Tag-Based KASAN with GCC
[ Upstream commit 894b00a3350c560990638bdf89bdf1f3d5491950 ] 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 Tested-by: Andrey Konovalov <andreyknvl@gmail.com> Cc: Andrew Pinski <pinskia@gmail.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Marco Elver <elver@google.com> Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com> Fixes: 7b861a53e46b ("kasan: Bump required compiler version") Link: https://lore.kernel.org/r/20241021120013.3209481-1-elver@google.com Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/compiler-gcc.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 8c9a095c1757..9e6961078c2a 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -102,7 +102,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__))