]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
objtool: Drop noinstr hack for KCSAN_WEAK_MEMORY
authorNathan Chancellor <nathan@kernel.org>
Thu, 21 Aug 2025 21:15:48 +0000 (14:15 -0700)
committerNathan Chancellor <nathan@kernel.org>
Thu, 28 Aug 2025 23:58:46 +0000 (16:58 -0700)
Now that the minimum supported version of LLVM for building the kernel
has been bumped to 15.0.0, __no_kcsan will always ensure that the thread
sanitizer functions are not generated, so remove the check for tsan
functions in is_profiling_func() and the always true depends and
unnecessary select lines in KCSAN_WEAK_MEMORY.

Acked-by: Marco Elver <elver@google.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infraded.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250821-bump-min-llvm-ver-15-v2-11-635f3294e5f0@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
lib/Kconfig.kcsan
tools/objtool/check.c

index 609ddfc73de5d47a31060420ecb5a810610664b3..4ce4b0c0109cb4f7708472861ada38ff70b4c141 100644 (file)
@@ -185,12 +185,6 @@ config KCSAN_WEAK_MEMORY
        bool "Enable weak memory modeling to detect missing memory barriers"
        default y
        depends on KCSAN_STRICT
-       # We can either let objtool nop __tsan_func_{entry,exit}() and builtin
-       # atomics instrumentation in .noinstr.text, or use a compiler that can
-       # implement __no_kcsan to really remove all instrumentation.
-       depends on !ARCH_WANTS_NO_INSTR || HAVE_NOINSTR_HACK || \
-                  CC_IS_GCC || CLANG_VERSION >= 140000
-       select OBJTOOL if HAVE_NOINSTR_HACK
        help
          Enable support for modeling a subset of weak memory, which allows
          detecting a subset of data races due to missing memory barriers.
index d14f20ef1db13f0d8a9ce711d524bac06b48579e..efa4c060ff4eb4c23d0ac8537c1b208b30702ac4 100644 (file)
@@ -2453,16 +2453,6 @@ static bool is_profiling_func(const char *name)
        if (!strncmp(name, "__sanitizer_cov_", 16))
                return true;
 
-       /*
-        * Some compilers currently do not remove __tsan_func_entry/exit nor
-        * __tsan_atomic_signal_fence (used for barrier instrumentation) with
-        * the __no_sanitize_thread attribute, remove them. Once the kernel's
-        * minimum Clang version is 14.0, this can be removed.
-        */
-       if (!strncmp(name, "__tsan_func_", 12) ||
-           !strcmp(name, "__tsan_atomic_signal_fence"))
-               return true;
-
        return false;
 }