Skip to content

Commit 894b00a

Browse files
melverwilldeacon
authored andcommitted
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 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: 7b861a5 ("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>
1 parent 7aed6a2 commit 894b00a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/linux/compiler-gcc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@
8080
#define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
8181
#endif
8282

83+
#ifdef __SANITIZE_HWADDRESS__
84+
#define __no_sanitize_address __attribute__((__no_sanitize__("hwaddress")))
85+
#else
8386
#define __no_sanitize_address __attribute__((__no_sanitize_address__))
87+
#endif
8488

8589
#if defined(__SANITIZE_THREAD__)
8690
#define __no_sanitize_thread __attribute__((__no_sanitize_thread__))

0 commit comments

Comments
 (0)