[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200604055811.247298-1-elver@google.com>
Date: Thu, 4 Jun 2020 07:58:10 +0200
From: Marco Elver <elver@...gle.com>
To: elver@...gle.com
Cc: will@...nel.org, peterz@...radead.org, bp@...en8.de,
tglx@...utronix.de, mingo@...nel.org,
clang-built-linux@...glegroups.com, paulmck@...nel.org,
dvyukov@...gle.com, glider@...gle.com, andreyknvl@...gle.com,
kasan-dev@...glegroups.com, linux-kernel@...r.kernel.org,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: [PATCH -tip v2 1/2] kasan: Bump required compiler version
Adds config variable CC_HAS_WORKING_NOSANITIZE_ADDRESS, which will be
true if we have a compiler that does not fail builds due to
no_sanitize_address functions. This does not yet mean they work as
intended, but for automated build-tests, this is the minimum
requirement.
For example, we require that __always_inline functions used from
no_sanitize_address functions do not generate instrumentation. On GCC <=
7 this fails to build entirely, therefore we make the minimum version
GCC 8.
Link: https://lkml.kernel.org/r/20200602175859.GC2604@hirez.programming.kicks-ass.net
Suggested-by: Peter Zijlstra <peterz@...radead.org>
Acked-by: Andrey Konovalov <andreyknvl@...gle.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
Signed-off-by: Marco Elver <elver@...gle.com>
---
Apply after:
https://lkml.kernel.org/r/20200602173103.931412766@infradead.org
v2:
* No longer restrict UBSAN (and KCSAN), since the attributes behave
differently for different sanitizers. For UBSAN the above case with GCC
<= 7 actually works fine (no compiler error). So it seems that only
KASAN is affected by this -- let's limit our restriction to KASAN.
---
lib/Kconfig.kasan | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index 81f5464ea9e1..af0dd09f91e9 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -15,11 +15,15 @@ config CC_HAS_KASAN_GENERIC
config CC_HAS_KASAN_SW_TAGS
def_bool $(cc-option, -fsanitize=kernel-hwaddress)
+config CC_HAS_WORKING_NOSANITIZE_ADDRESS
+ def_bool !CC_IS_GCC || GCC_VERSION >= 80000
+
config KASAN
bool "KASAN: runtime memory debugger"
depends on (HAVE_ARCH_KASAN && CC_HAS_KASAN_GENERIC) || \
(HAVE_ARCH_KASAN_SW_TAGS && CC_HAS_KASAN_SW_TAGS)
depends on (SLUB && SYSFS) || (SLAB && !DEBUG_SLAB)
+ depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS
help
Enables KASAN (KernelAddressSANitizer) - runtime memory debugger,
designed to find out-of-bounds accesses and use-after-free bugs.
--
2.27.0.rc2.251.g90737beb825-goog
Powered by blists - more mailing lists