x86/bugs: Rename CONFIG_CPU_UNRET_ENTRY => CONFIG_MITIGATION_UNRET_ENTRY
authorBreno Leitao <leitao@debian.org>
Tue, 21 Nov 2023 16:07:34 +0000 (08:07 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 10 Jan 2024 09:52:28 +0000 (10:52 +0100)
Step 7/10 of the namespace unification of CPU mitigations related Kconfig options.

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-8-leitao@debian.org
arch/x86/Kconfig
arch/x86/include/asm/disabled-features.h
arch/x86/include/asm/nospec-branch.h
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/vmlinux.lds.S
arch/x86/lib/retpoline.S
include/linux/objtool.h
scripts/Makefile.vmlinux_o
tools/arch/x86/include/asm/disabled-features.h

index ba4546556fc550352321ea804f75f4505ee03424..77b8769f302615d209331c4a5aae5a6e55e22c34 100644 (file)
@@ -2516,7 +2516,7 @@ config RETHUNK
          Requires a compiler with -mfunction-return=thunk-extern
          support for full protection. The kernel may run slower.
 
-config CPU_UNRET_ENTRY
+config MITIGATION_UNRET_ENTRY
        bool "Enable UNRET on kernel entry"
        depends on CPU_SUP_AMD && RETHUNK && X86_64
        default y
index 24e4010c33b6a4e8d0e6f3acc0aba03fb1ae5594..151f0d50e7e0350d310164556d30589d2014614b 100644 (file)
@@ -63,7 +63,7 @@
 # define DISABLE_RETHUNK       (1 << (X86_FEATURE_RETHUNK & 31))
 #endif
 
-#ifdef CONFIG_CPU_UNRET_ENTRY
+#ifdef CONFIG_MITIGATION_UNRET_ENTRY
 # define DISABLE_UNRET         0
 #else
 # define DISABLE_UNRET         (1 << (X86_FEATURE_UNRET & 31))
index 32680cb720038b631a00073b2135eace6c7cffd8..97478690a5794ff54132c14181ea7614ac894906 100644 (file)
  */
 .macro VALIDATE_UNRET_END
 #if defined(CONFIG_NOINSTR_VALIDATION) && \
-       (defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO))
+       (defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO))
        ANNOTATE_RETPOLINE_SAFE
        nop
 #endif
 .Lskip_rsb_\@:
 .endm
 
-#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)
+#if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)
 #define CALL_UNTRAIN_RET       "call entry_untrain_ret"
 #else
 #define CALL_UNTRAIN_RET       ""
@@ -334,7 +334,7 @@ extern void __x86_return_thunk(void);
 static inline void __x86_return_thunk(void) {}
 #endif
 
-#ifdef CONFIG_CPU_UNRET_ENTRY
+#ifdef CONFIG_MITIGATION_UNRET_ENTRY
 extern void retbleed_return_thunk(void);
 #else
 static inline void retbleed_return_thunk(void) {}
index 9f42d1c59e095ee6923a78cb2ecb04fbe375a438..6c7db2ec2c5e50cee5313b4a16a9b7e45064f278 100644 (file)
@@ -928,7 +928,7 @@ static void fix_erratum_1386(struct cpuinfo_x86 *c)
 
 void init_spectral_chicken(struct cpuinfo_x86 *c)
 {
-#ifdef CONFIG_CPU_UNRET_ENTRY
+#ifdef CONFIG_MITIGATION_UNRET_ENTRY
        u64 value;
 
        /*
index fc46fd6447f9f340850d6f7ce6226d417fda6ac4..2580368c32d1fa6efaca461dcaa9cd76236efbd6 100644 (file)
@@ -982,10 +982,10 @@ static void __init retbleed_select_mitigation(void)
                return;
 
        case RETBLEED_CMD_UNRET:
-               if (IS_ENABLED(CONFIG_CPU_UNRET_ENTRY)) {
+               if (IS_ENABLED(CONFIG_MITIGATION_UNRET_ENTRY)) {
                        retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
                } else {
-                       pr_err("WARNING: kernel not compiled with CPU_UNRET_ENTRY.\n");
+                       pr_err("WARNING: kernel not compiled with MITIGATION_UNRET_ENTRY.\n");
                        goto do_cmd_auto;
                }
                break;
@@ -1021,7 +1021,7 @@ do_cmd_auto:
        case RETBLEED_CMD_AUTO:
                if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
                    boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
-                       if (IS_ENABLED(CONFIG_CPU_UNRET_ENTRY))
+                       if (IS_ENABLED(CONFIG_MITIGATION_UNRET_ENTRY))
                                retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
                        else if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY) &&
                                 boot_cpu_has(X86_FEATURE_IBPB))
index bb2ec03f046d1686f95dcd40de32a1047a7727bb..9c5cca50a36fae8c8d1e68f77c197100ec939940 100644 (file)
@@ -504,7 +504,7 @@ INIT_PER_CPU(irq_stack_backing_store);
            "fixed_percpu_data is not at start of per-cpu area");
 #endif
 
-#ifdef CONFIG_CPU_UNRET_ENTRY
+#ifdef CONFIG_MITIGATION_UNRET_ENTRY
 . = ASSERT((retbleed_return_thunk & 0x3f) == 0, "retbleed_return_thunk not cacheline-aligned");
 #endif
 
index ff46f48a0cc4d7708d5a6d7439cdb9550f37bdcc..0ad67ccadd4c740729607c875ca9c17c5a6a2c20 100644 (file)
@@ -230,7 +230,7 @@ SYM_CODE_END(srso_return_thunk)
 #define JMP_SRSO_ALIAS_UNTRAIN_RET "ud2"
 #endif /* CONFIG_CPU_SRSO */
 
-#ifdef CONFIG_CPU_UNRET_ENTRY
+#ifdef CONFIG_MITIGATION_UNRET_ENTRY
 
 /*
  * Some generic notes on the untraining sequences:
@@ -312,11 +312,11 @@ SYM_CODE_END(retbleed_return_thunk)
 SYM_FUNC_END(retbleed_untrain_ret)
 
 #define JMP_RETBLEED_UNTRAIN_RET "jmp retbleed_untrain_ret"
-#else /* !CONFIG_CPU_UNRET_ENTRY */
+#else /* !CONFIG_MITIGATION_UNRET_ENTRY */
 #define JMP_RETBLEED_UNTRAIN_RET "ud2"
-#endif /* CONFIG_CPU_UNRET_ENTRY */
+#endif /* CONFIG_MITIGATION_UNRET_ENTRY */
 
-#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)
+#if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)
 
 SYM_FUNC_START(entry_untrain_ret)
        ALTERNATIVE_2 JMP_RETBLEED_UNTRAIN_RET,                         \
@@ -325,7 +325,7 @@ SYM_FUNC_START(entry_untrain_ret)
 SYM_FUNC_END(entry_untrain_ret)
 __EXPORT_THUNK(entry_untrain_ret)
 
-#endif /* CONFIG_CPU_UNRET_ENTRY || CONFIG_CPU_SRSO */
+#endif /* CONFIG_MITIGATION_UNRET_ENTRY || CONFIG_CPU_SRSO */
 
 #ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
 
index 33212e93f4a6318493342a541894ec0879a884fa..d030671a4c49d9e69425dc0242959a929d68694c 100644 (file)
  */
 .macro VALIDATE_UNRET_BEGIN
 #if defined(CONFIG_NOINSTR_VALIDATION) && \
-       (defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO))
+       (defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO))
 .Lhere_\@:
        .pushsection .discard.validate_unret
        .long   .Lhere_\@ - .
index 25b3b587d37c00cd77415ef8d6533e9a18c4dcc9..6277dbd730bbb05574c0710c8c0074b8410a5e1b 100644 (file)
@@ -38,7 +38,7 @@ objtool-enabled := $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION))
 vmlinux-objtool-args-$(delay-objtool)                  += $(objtool-args-y)
 vmlinux-objtool-args-$(CONFIG_GCOV_KERNEL)             += --no-unreachable
 vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION)      += --noinstr \
-                                                          $(if $(or $(CONFIG_CPU_UNRET_ENTRY),$(CONFIG_CPU_SRSO)), --unret)
+                                                          $(if $(or $(CONFIG_MITIGATION_UNRET_ENTRY),$(CONFIG_CPU_SRSO)), --unret)
 
 objtool-args = $(vmlinux-objtool-args-y) --link
 
index 24e4010c33b6a4e8d0e6f3acc0aba03fb1ae5594..151f0d50e7e0350d310164556d30589d2014614b 100644 (file)
@@ -63,7 +63,7 @@
 # define DISABLE_RETHUNK       (1 << (X86_FEATURE_RETHUNK & 31))
 #endif
 
-#ifdef CONFIG_CPU_UNRET_ENTRY
+#ifdef CONFIG_MITIGATION_UNRET_ENTRY
 # define DISABLE_UNRET         0
 #else
 # define DISABLE_UNRET         (1 << (X86_FEATURE_UNRET & 31))