]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/bugs: Rename CONFIG_RETHUNK => CONFIG_MITIGATION_RETHUNK
authorBreno Leitao <leitao@debian.org>
Tue, 21 Nov 2023 16:07:37 +0000 (08:07 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 10 Jan 2024 09:52:29 +0000 (10:52 +0100)
Step 10/10 of the namespace unification of CPU mitigations related Kconfig options.

[ mingo: Added one more case. ]

Suggested-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20231121160740.1249350-11-leitao@debian.org
13 files changed:
arch/x86/Kconfig
arch/x86/Makefile
arch/x86/configs/i386_defconfig
arch/x86/include/asm/disabled-features.h
arch/x86/include/asm/linkage.h
arch/x86/include/asm/nospec-branch.h
arch/x86/include/asm/static_call.h
arch/x86/kernel/alternative.c
arch/x86/kernel/static_call.c
arch/x86/lib/retpoline.S
scripts/Makefile.lib
tools/arch/x86/include/asm/disabled-features.h
tools/objtool/check.c

index a2743b7f2a18f68ea04fe827fa824613113a6508..0a9fea390ef30233401d1d2d652edc4741a85336 100644 (file)
@@ -2462,7 +2462,7 @@ config FINEIBT
 
 config HAVE_CALL_THUNKS
        def_bool y
-       depends on CC_HAS_ENTRY_PADDING && RETHUNK && OBJTOOL
+       depends on CC_HAS_ENTRY_PADDING && MITIGATION_RETHUNK && OBJTOOL
 
 config CALL_THUNKS
        def_bool n
@@ -2505,7 +2505,7 @@ config MITIGATION_RETPOLINE
          branches. Requires a compiler with -mindirect-branch=thunk-extern
          support for full protection. The kernel may run slower.
 
-config RETHUNK
+config MITIGATION_RETHUNK
        bool "Enable return-thunks"
        depends on MITIGATION_RETPOLINE && CC_HAS_RETURN_THUNK
        select OBJTOOL if HAVE_OBJTOOL
@@ -2518,7 +2518,7 @@ config RETHUNK
 
 config MITIGATION_UNRET_ENTRY
        bool "Enable UNRET on kernel entry"
-       depends on CPU_SUP_AMD && RETHUNK && X86_64
+       depends on CPU_SUP_AMD && MITIGATION_RETHUNK && X86_64
        default y
        help
          Compile the kernel with support for the retbleed=unret mitigation.
@@ -2572,7 +2572,7 @@ config MITIGATION_IBRS_ENTRY
 
 config MITIGATION_SRSO
        bool "Mitigate speculative RAS overflow on AMD"
-       depends on CPU_SUP_AMD && X86_64 && RETHUNK
+       depends on CPU_SUP_AMD && X86_64 && MITIGATION_RETHUNK
        default y
        help
          Enable the SRSO mitigation needed on AMD Zen1-4 machines.
index 5ce8c30e77010f414d3a335094975bda5236b6bd..ba046afb850e518ad2fbe707210f551e5d4cde0e 100644 (file)
@@ -22,7 +22,7 @@ RETPOLINE_VDSO_CFLAGS := -mretpoline
 endif
 RETPOLINE_CFLAGS       += $(call cc-option,-mindirect-branch-cs-prefix)
 
-ifdef CONFIG_RETHUNK
+ifdef CONFIG_MITIGATION_RETHUNK
 RETHUNK_CFLAGS         := -mfunction-return=thunk-extern
 RETPOLINE_CFLAGS       += $(RETHUNK_CFLAGS)
 endif
index 73abbbdd26f87d73ea85b962f686ef178f06bad3..91801138b10bbffa44d6702dbcecdab5275fd034 100644 (file)
@@ -42,7 +42,7 @@ CONFIG_EFI_STUB=y
 CONFIG_HZ_1000=y
 CONFIG_KEXEC=y
 CONFIG_CRASH_DUMP=y
-# CONFIG_RETHUNK is not set
+# CONFIG_MITIGATION_RETHUNK is not set
 CONFIG_HIBERNATION=y
 CONFIG_PM_DEBUG=y
 CONFIG_PM_TRACE_RTC=y
index 151f0d50e7e0350d310164556d30589d2014614b..36d0c1e05e608afcee144516f087fd8ef264ad62 100644 (file)
@@ -57,7 +57,7 @@
                                 (1 << (X86_FEATURE_RETPOLINE_LFENCE & 31)))
 #endif
 
-#ifdef CONFIG_RETHUNK
+#ifdef CONFIG_MITIGATION_RETHUNK
 # define DISABLE_RETHUNK       0
 #else
 # define DISABLE_RETHUNK       (1 << (X86_FEATURE_RETHUNK & 31))
index 09e2d026df333b786b21e3539c109e1143d38ef2..dc31b13b87a0d17020aaf2d3915da366b1b62d59 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifdef __ASSEMBLY__
 
-#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
+#if defined(CONFIG_MITIGATION_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
 #define RET    jmp __x86_return_thunk
 #else /* CONFIG_MITIGATION_RETPOLINE */
 #ifdef CONFIG_MITIGATION_SLS
@@ -52,7 +52,7 @@
 
 #else /* __ASSEMBLY__ */
 
-#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
+#if defined(CONFIG_MITIGATION_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
 #define ASM_RET        "jmp __x86_return_thunk\n\t"
 #else /* CONFIG_MITIGATION_RETPOLINE */
 #ifdef CONFIG_MITIGATION_SLS
index 94c70832994f359760b54973c5d4793b72903081..2c0679ebe9146a32e66bb69f366edeef404c7f26 100644 (file)
  * where we have a stack but before any RET instruction.
  */
 .macro __UNTRAIN_RET ibpb_feature, call_depth_insns
-#if defined(CONFIG_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY)
+#if defined(CONFIG_MITIGATION_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY)
        VALIDATE_UNRET_END
        ALTERNATIVE_3 "",                                               \
                      CALL_UNTRAIN_RET, X86_FEATURE_UNRET,              \
@@ -328,7 +328,7 @@ extern retpoline_thunk_t __x86_indirect_thunk_array[];
 extern retpoline_thunk_t __x86_indirect_call_thunk_array[];
 extern retpoline_thunk_t __x86_indirect_jump_thunk_array[];
 
-#ifdef CONFIG_RETHUNK
+#ifdef CONFIG_MITIGATION_RETHUNK
 extern void __x86_return_thunk(void);
 #else
 static inline void __x86_return_thunk(void) {}
index 343b722ccaf21d0654b5d7dc19596a4ef548a8e5..125c407e2abe6da21a05f8a644ecce501ed1c910 100644 (file)
@@ -46,7 +46,7 @@
 #define ARCH_DEFINE_STATIC_CALL_TRAMP(name, func)                      \
        __ARCH_DEFINE_STATIC_CALL_TRAMP(name, ".byte 0xe9; .long " #func " - (. + 4)")
 
-#ifdef CONFIG_RETHUNK
+#ifdef CONFIG_MITIGATION_RETHUNK
 #define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name)                       \
        __ARCH_DEFINE_STATIC_CALL_TRAMP(name, "jmp __x86_return_thunk")
 #else
index f5442d0d2ee9bbe0671837890a0884b21cbfd6e8..df91abea3420f5f97e0a606c9fdea941290e0ee3 100644 (file)
@@ -769,7 +769,7 @@ void __init_or_module noinline apply_retpolines(s32 *start, s32 *end)
        }
 }
 
-#ifdef CONFIG_RETHUNK
+#ifdef CONFIG_MITIGATION_RETHUNK
 
 /*
  * Rewrite the compiler generated return thunk tail-calls.
@@ -842,7 +842,7 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end)
 }
 #else
 void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
-#endif /* CONFIG_RETHUNK */
+#endif /* CONFIG_MITIGATION_RETHUNK */
 
 #else /* !CONFIG_MITIGATION_RETPOLINE || !CONFIG_OBJTOOL */
 
index 77a9316da43573de5f1a7a2e6f220a1190600862..4eefaac64c6cbabbd1a73ac714993ce831647792 100644 (file)
@@ -172,7 +172,7 @@ void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
 }
 EXPORT_SYMBOL_GPL(arch_static_call_transform);
 
-#ifdef CONFIG_RETHUNK
+#ifdef CONFIG_MITIGATION_RETHUNK
 /*
  * This is called by apply_returns() to fix up static call trampolines,
  * specifically ARCH_DEFINE_STATIC_CALL_NULL_TRAMP which is recorded as
index 67b52cbec64889eb2a9a6c51662af1f8c053461b..0045153ba2224f40623c07d7960c4353879ab6cf 100644 (file)
@@ -127,7 +127,7 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array)
 #undef GEN
 #endif
 
-#ifdef CONFIG_RETHUNK
+#ifdef CONFIG_MITIGATION_RETHUNK
 
 /*
  * Be careful here: that label cannot really be removed because in
@@ -386,4 +386,4 @@ SYM_CODE_START(__x86_return_thunk)
 SYM_CODE_END(__x86_return_thunk)
 EXPORT_SYMBOL(__x86_return_thunk)
 
-#endif /* CONFIG_RETHUNK */
+#endif /* CONFIG_MITIGATION_RETHUNK */
index b272ca64cd7582ad5bea76310e37e898b0cf2161..c3f4cacad7b0984925b4a2350d7e7d8ee8b63635 100644 (file)
@@ -263,7 +263,7 @@ objtool-args-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT)              += --mnop
 endif
 objtool-args-$(CONFIG_UNWINDER_ORC)                    += --orc
 objtool-args-$(CONFIG_MITIGATION_RETPOLINE)            += --retpoline
-objtool-args-$(CONFIG_RETHUNK)                         += --rethunk
+objtool-args-$(CONFIG_MITIGATION_RETHUNK)              += --rethunk
 objtool-args-$(CONFIG_MITIGATION_SLS)                  += --sls
 objtool-args-$(CONFIG_STACK_VALIDATION)                        += --stackval
 objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE)         += --static-call
index 151f0d50e7e0350d310164556d30589d2014614b..36d0c1e05e608afcee144516f087fd8ef264ad62 100644 (file)
@@ -57,7 +57,7 @@
                                 (1 << (X86_FEATURE_RETPOLINE_LFENCE & 31)))
 #endif
 
-#ifdef CONFIG_RETHUNK
+#ifdef CONFIG_MITIGATION_RETHUNK
 # define DISABLE_RETHUNK       0
 #else
 # define DISABLE_RETHUNK       (1 << (X86_FEATURE_RETHUNK & 31))
index 84067f018f7ec5fd7f62b383ac020053eb4f5f59..8440b7bb343cc769d6cd45f64a5ab02f893afb11 100644 (file)
@@ -3980,7 +3980,7 @@ static int validate_retpoline(struct objtool_file *file)
 
                if (insn->type == INSN_RETURN) {
                        if (opts.rethunk) {
-                               WARN_INSN(insn, "'naked' return found in RETHUNK build");
+                               WARN_INSN(insn, "'naked' return found in MITIGATION_RETHUNK build");
                        } else
                                continue;
                } else {