aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Kconfig.kasan22
-rw-r--r--scripts/Makefile.kasan2
2 files changed, 23 insertions, 1 deletions
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index d8c474b6691e..9737059ec58b 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -113,6 +113,28 @@ config KASAN_INLINE
113 113
114endchoice 114endchoice
115 115
116config KASAN_STACK_ENABLE
117 bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST
118 default !(CLANG_VERSION < 90000)
119 depends on KASAN
120 help
121 The LLVM stack address sanitizer has a know problem that
122 causes excessive stack usage in a lot of functions, see
123 https://bugs.llvm.org/show_bug.cgi?id=38809
124 Disabling asan-stack makes it safe to run kernels build
125 with clang-8 with KASAN enabled, though it loses some of
126 the functionality.
127 This feature is always disabled when compile-testing with clang-8
128 or earlier to avoid cluttering the output in stack overflow
129 warnings, but clang-8 users can still enable it for builds without
130 CONFIG_COMPILE_TEST. On gcc and later clang versions it is
131 assumed to always be safe to use and enabled by default.
132
133config KASAN_STACK
134 int
135 default 1 if KASAN_STACK_ENABLE || CC_IS_GCC
136 default 0
137
116config KASAN_S390_4_LEVEL_PAGING 138config KASAN_S390_4_LEVEL_PAGING
117 bool "KASan: use 4-level paging" 139 bool "KASan: use 4-level paging"
118 depends on KASAN && S390 140 depends on KASAN && S390
diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 25c259df8ffa..6deabedc67fc 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -26,7 +26,7 @@ else
26 CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ 26 CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \
27 $(call cc-param,asan-globals=1) \ 27 $(call cc-param,asan-globals=1) \
28 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ 28 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \
29 $(call cc-param,asan-stack=1) \ 29 $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \
30 $(call cc-param,asan-use-after-scope=1) \ 30 $(call cc-param,asan-use-after-scope=1) \
31 $(call cc-param,asan-instrument-allocas=1) 31 $(call cc-param,asan-instrument-allocas=1)
32endif 32endif