Skip to content

Commit 2e4eb18

Browse files
melvergregkh
authored andcommitted
kasan: Fix Software Tag-Based KASAN with GCC
[ Upstream commit 894b00a ] 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/[email protected] Link: https://lore.kernel.org/r/ZvFGwKfoC4yVjN_X@J2N7QTR9R3 Link: https://bugzilla.kernel.org/show_bug.cgi?id=218854 Reported-by: [email protected] Tested-by: Andrey Konovalov <[email protected]> Cc: Andrew Pinski <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Marco Elver <[email protected]> Reviewed-by: Andrey Konovalov <[email protected]> Fixes: 7b861a5 ("kasan: Bump required compiler version") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 4c35757 commit 2e4eb18

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
@@ -102,7 +102,11 @@
102102
#define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
103103
#endif
104104

105+
#ifdef __SANITIZE_HWADDRESS__
106+
#define __no_sanitize_address __attribute__((__no_sanitize__("hwaddress")))
107+
#else
105108
#define __no_sanitize_address __attribute__((__no_sanitize_address__))
109+
#endif
106110

107111
#if defined(__SANITIZE_THREAD__)
108112
#define __no_sanitize_thread __attribute__((__no_sanitize_thread__))

0 commit comments

Comments
 (0)