Merge branch 'x86/bugs' into x86/core, to pick up pending changes before dependent...
authorIngo Molnar <mingo@kernel.org>
Wed, 14 Feb 2024 09:48:28 +0000 (10:48 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 14 Feb 2024 09:49:37 +0000 (10:49 +0100)
Merge in pending alternatives patching infrastructure changes, before
applying more patches.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
71 files changed:
Documentation/admin-guide/hw-vuln/spectre.rst
Documentation/admin-guide/kernel-parameters.txt
Documentation/arch/x86/pti.rst
arch/x86/Kconfig
arch/x86/Makefile
arch/x86/boot/compressed/ident_map_64.c
arch/x86/configs/i386_defconfig
arch/x86/entry/calling.h
arch/x86/entry/entry.S
arch/x86/entry/entry_64.S
arch/x86/entry/thunk_32.S
arch/x86/entry/thunk_64.S
arch/x86/entry/vdso/Makefile
arch/x86/include/asm/current.h
arch/x86/include/asm/disabled-features.h
arch/x86/include/asm/linkage.h
arch/x86/include/asm/nospec-branch.h
arch/x86/include/asm/pgalloc.h
arch/x86/include/asm/pgtable-3level.h
arch/x86/include/asm/pgtable.h
arch/x86/include/asm/pgtable_64.h
arch/x86/include/asm/processor-flags.h
arch/x86/include/asm/pti.h
arch/x86/include/asm/static_call.h
arch/x86/kernel/alternative.c
arch/x86/kernel/asm-offsets.c
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/dumpstack.c
arch/x86/kernel/ftrace.c
arch/x86/kernel/head_32.S
arch/x86/kernel/head_64.S
arch/x86/kernel/kprobes/opt.c
arch/x86/kernel/ldt.c
arch/x86/kernel/static_call.c
arch/x86/kernel/vmlinux.lds.S
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/mmu_internal.h
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/vmenter.S
arch/x86/kvm/vmx/vmx.c
arch/x86/lib/Makefile
arch/x86/lib/retpoline.S
arch/x86/mm/Makefile
arch/x86/mm/debug_pagetables.c
arch/x86/mm/dump_pagetables.c
arch/x86/mm/pgtable.c
arch/x86/mm/tlb.c
arch/x86/net/bpf_jit_comp.c
arch/x86/net/bpf_jit_comp32.c
arch/x86/purgatory/Makefile
include/linux/compiler-gcc.h
include/linux/indirect_call_wrapper.h
include/linux/module.h
include/linux/objtool.h
include/linux/pti.h
include/net/netfilter/nf_tables_core.h
include/net/tc_wrapper.h
kernel/trace/ring_buffer.c
net/netfilter/Makefile
net/netfilter/nf_tables_core.c
net/netfilter/nft_ct.c
net/netfilter/nft_lookup.c
net/sched/sch_api.c
scripts/Makefile.lib
scripts/Makefile.vmlinux_o
scripts/generate_rust_target.rs
scripts/mod/modpost.c
tools/arch/x86/include/asm/disabled-features.h
tools/objtool/arch/x86/special.c
tools/objtool/check.c

index 32a8893e5617764e1a9ca1ae4e106150decf2952..cce768afec6bed11a961643dcdc2d1ae97848684 100644 (file)
@@ -473,8 +473,8 @@ Spectre variant 2
    -mindirect-branch=thunk-extern -mindirect-branch-register options.
    If the kernel is compiled with a Clang compiler, the compiler needs
    to support -mretpoline-external-thunk option.  The kernel config
-   CONFIG_RETPOLINE needs to be turned on, and the CPU needs to run with
-   the latest updated microcode.
+   CONFIG_MITIGATION_RETPOLINE needs to be turned on, and the CPU needs
+   to run with the latest updated microcode.
 
    On Intel Skylake-era systems the mitigation covers most, but not all,
    cases. See :ref:`[3] <spec_ref3>` for more details.
@@ -609,8 +609,8 @@ kernel command line.
                Selecting 'on' will, and 'auto' may, choose a
                mitigation method at run time according to the
                CPU, the available microcode, the setting of the
-               CONFIG_RETPOLINE configuration option, and the
-               compiler with which the kernel was built.
+               CONFIG_MITIGATION_RETPOLINE configuration option,
+               and the compiler with which the kernel was built.
 
                Selecting 'on' will also enable the mitigation
                against user space to user space task attacks.
index 31b3a25680d08cfac3603d58b3d3783bbf1e34bb..f42618b958255155f403256b5bf24bb9c310bd30 100644 (file)
                        Selecting 'on' will, and 'auto' may, choose a
                        mitigation method at run time according to the
                        CPU, the available microcode, the setting of the
-                       CONFIG_RETPOLINE configuration option, and the
-                       compiler with which the kernel was built.
+                       CONFIG_MITIGATION_RETPOLINE configuration option,
+                       and the compiler with which the kernel was built.
 
                        Selecting 'on' will also enable the mitigation
                        against user space to user space task attacks.
index e08d35177bc028b4878207e3feadcbce71e9811e..57e8392f61d35460927904f0436164d129a6ee50 100644 (file)
@@ -26,9 +26,9 @@ comments in pti.c).
 
 This approach helps to ensure that side-channel attacks leveraging
 the paging structures do not function when PTI is enabled.  It can be
-enabled by setting CONFIG_PAGE_TABLE_ISOLATION=y at compile time.
-Once enabled at compile-time, it can be disabled at boot with the
-'nopti' or 'pti=' kernel parameters (see kernel-parameters.txt).
+enabled by setting CONFIG_MITIGATION_PAGE_TABLE_ISOLATION=y at compile
+time.  Once enabled at compile-time, it can be disabled at boot with
+the 'nopti' or 'pti=' kernel parameters (see kernel-parameters.txt).
 
 Page Table Management
 =====================
index 0a31b515d1205d0246e72fb796083e74c70049b6..502986237cb65a9d4a6a301d3182b827254cba6b 100644 (file)
@@ -2477,12 +2477,12 @@ config CALL_PADDING
 
 config FINEIBT
        def_bool y
-       depends on X86_KERNEL_IBT && CFI_CLANG && RETPOLINE
+       depends on X86_KERNEL_IBT && CFI_CLANG && MITIGATION_RETPOLINE
        select CALL_PADDING
 
 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
@@ -2504,7 +2504,7 @@ menuconfig SPECULATION_MITIGATIONS
 
 if SPECULATION_MITIGATIONS
 
-config PAGE_TABLE_ISOLATION
+config MITIGATION_PAGE_TABLE_ISOLATION
        bool "Remove the kernel mapping in user mode"
        default y
        depends on (X86_64 || X86_PAE)
@@ -2515,7 +2515,7 @@ config PAGE_TABLE_ISOLATION
 
          See Documentation/arch/x86/pti.rst for more details.
 
-config RETPOLINE
+config MITIGATION_RETPOLINE
        bool "Avoid speculative indirect branches in kernel"
        select OBJTOOL if HAVE_OBJTOOL
        default y
@@ -2525,9 +2525,9 @@ config 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 RETPOLINE && CC_HAS_RETURN_THUNK
+       depends on MITIGATION_RETPOLINE && CC_HAS_RETURN_THUNK
        select OBJTOOL if HAVE_OBJTOOL
        default y if X86_64
        help
@@ -2536,14 +2536,14 @@ 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
+       depends on CPU_SUP_AMD && MITIGATION_RETHUNK && X86_64
        default y
        help
          Compile the kernel with support for the retbleed=unret mitigation.
 
-config CALL_DEPTH_TRACKING
+config MITIGATION_CALL_DEPTH_TRACKING
        bool "Mitigate RSB underflow with call depth tracking"
        depends on CPU_SUP_INTEL && HAVE_CALL_THUNKS
        select HAVE_DYNAMIC_FTRACE_NO_PATCHABLE
@@ -2563,7 +2563,7 @@ config CALL_DEPTH_TRACKING
 
 config CALL_THUNKS_DEBUG
        bool "Enable call thunks and call depth tracking debugging"
-       depends on CALL_DEPTH_TRACKING
+       depends on MITIGATION_CALL_DEPTH_TRACKING
        select FUNCTION_ALIGNMENT_32B
        default n
        help
@@ -2574,14 +2574,14 @@ config CALL_THUNKS_DEBUG
          Only enable this when you are debugging call thunks as this
          creates a noticeable runtime overhead. If unsure say N.
 
-config CPU_IBPB_ENTRY
+config MITIGATION_IBPB_ENTRY
        bool "Enable IBPB on kernel entry"
        depends on CPU_SUP_AMD && X86_64
        default y
        help
          Compile the kernel with support for the retbleed=ibpb mitigation.
 
-config CPU_IBRS_ENTRY
+config MITIGATION_IBRS_ENTRY
        bool "Enable IBRS on kernel entry"
        depends on CPU_SUP_INTEL && X86_64
        default y
@@ -2590,14 +2590,14 @@ config CPU_IBRS_ENTRY
          This mitigates both spectre_v2 and retbleed at great cost to
          performance.
 
-config CPU_SRSO
+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.
 
-config SLS
+config MITIGATION_SLS
        bool "Mitigate Straight-Line-Speculation"
        depends on CC_HAS_SLS && X86_64
        select OBJTOOL if HAVE_OBJTOOL
@@ -2607,7 +2607,7 @@ config SLS
          against straight line speculation. The kernel image might be slightly
          larger.
 
-config GDS_FORCE_MITIGATION
+config MITIGATION_GDS_FORCE
        bool "Force GDS Mitigation"
        depends on CPU_SUP_INTEL
        default n
index 2264db14a25d3b034ffa93685d6353564d4a9225..c54f835fc062c0c36755ffe4829e48acc9226e4f 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
@@ -192,7 +192,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 
 # Avoid indirect branches in kernel to deal with Spectre
-ifdef CONFIG_RETPOLINE
+ifdef CONFIG_MITIGATION_RETPOLINE
   KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)
   # Additionally, avoid generating expensive indirect jumps which
   # are subject to retpolines for small number of switch cases.
@@ -205,7 +205,7 @@ ifdef CONFIG_RETPOLINE
   endif
 endif
 
-ifdef CONFIG_SLS
+ifdef CONFIG_MITIGATION_SLS
   KBUILD_CFLAGS += -mharden-sls=all
 endif
 
@@ -301,7 +301,7 @@ vdso-install-$(CONFIG_IA32_EMULATION)       += arch/x86/entry/vdso/vdso32.so.dbg
 
 archprepare: checkbin
 checkbin:
-ifdef CONFIG_RETPOLINE
+ifdef CONFIG_MITIGATION_RETPOLINE
 ifeq ($(RETPOLINE_CFLAGS),)
        @echo "You are building kernel with non-retpoline compiler." >&2
        @echo "Please update your compiler." >&2
index d040080d7edbd6ba53b9556102ac732a4f90e8e3..ff09ca6dbb87eeda39878ad8badb875e74a07934 100644 (file)
@@ -8,8 +8,8 @@
  * Copyright (C)      2016  Kees Cook
  */
 
-/* No PAGE_TABLE_ISOLATION support needed either: */
-#undef CONFIG_PAGE_TABLE_ISOLATION
+/* No MITIGATION_PAGE_TABLE_ISOLATION support needed either: */
+#undef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 
 #include "error.h"
 #include "misc.h"
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 e59d3073e7cf2e4daaccf986108c5c8ea21c1504..650c63795ca3039415d6acb88bd5c75c981c097e 100644 (file)
@@ -142,10 +142,10 @@ For 32-bit we have the following conventions - kernel is built with
        .endif
 .endm
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 
 /*
- * PAGE_TABLE_ISOLATION PGDs are 8k.  Flip bit 12 to switch between the two
+ * MITIGATION_PAGE_TABLE_ISOLATION PGDs are 8k.  Flip bit 12 to switch between the two
  * halves:
  */
 #define PTI_USER_PGTABLE_BIT           PAGE_SHIFT
@@ -160,7 +160,7 @@ For 32-bit we have the following conventions - kernel is built with
 
 .macro ADJUST_KERNEL_CR3 reg:req
        ALTERNATIVE "", "SET_NOFLUSH_BIT \reg", X86_FEATURE_PCID
-       /* Clear PCID and "PAGE_TABLE_ISOLATION bit", point CR3 at kernel pagetables: */
+       /* Clear PCID and "MITIGATION_PAGE_TABLE_ISOLATION bit", point CR3 at kernel pagetables: */
        andq    $(~PTI_USER_PGTABLE_AND_PCID_MASK), \reg
 .endm
 
@@ -275,7 +275,7 @@ For 32-bit we have the following conventions - kernel is built with
 .Lend_\@:
 .endm
 
-#else /* CONFIG_PAGE_TABLE_ISOLATION=n: */
+#else /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION=n: */
 
 .macro SWITCH_TO_KERNEL_CR3 scratch_reg:req
 .endm
@@ -303,7 +303,7 @@ For 32-bit we have the following conventions - kernel is built with
  * Assumes x86_spec_ctrl_{base,current} to have SPEC_CTRL_IBRS set.
  */
 .macro IBRS_ENTER save_reg
-#ifdef CONFIG_CPU_IBRS_ENTRY
+#ifdef CONFIG_MITIGATION_IBRS_ENTRY
        ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_KERNEL_IBRS
        movl    $MSR_IA32_SPEC_CTRL, %ecx
 
@@ -332,7 +332,7 @@ For 32-bit we have the following conventions - kernel is built with
  * regs. Must be called after the last RET.
  */
 .macro IBRS_EXIT save_reg
-#ifdef CONFIG_CPU_IBRS_ENTRY
+#ifdef CONFIG_MITIGATION_IBRS_ENTRY
        ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_KERNEL_IBRS
        movl    $MSR_IA32_SPEC_CTRL, %ecx
 
@@ -426,3 +426,63 @@ For 32-bit we have the following conventions - kernel is built with
 .endm
 
 #endif /* CONFIG_SMP */
+
+#ifdef CONFIG_X86_64
+
+/* rdi:        arg1 ... normal C conventions. rax is saved/restored. */
+.macro THUNK name, func
+SYM_FUNC_START(\name)
+       pushq %rbp
+       movq %rsp, %rbp
+
+       pushq %rdi
+       pushq %rsi
+       pushq %rdx
+       pushq %rcx
+       pushq %rax
+       pushq %r8
+       pushq %r9
+       pushq %r10
+       pushq %r11
+
+       call \func
+
+       popq %r11
+       popq %r10
+       popq %r9
+       popq %r8
+       popq %rax
+       popq %rcx
+       popq %rdx
+       popq %rsi
+       popq %rdi
+       popq %rbp
+       RET
+SYM_FUNC_END(\name)
+       _ASM_NOKPROBE(\name)
+.endm
+
+#else /* CONFIG_X86_32 */
+
+/* put return address in eax (arg1) */
+.macro THUNK name, func, put_ret_addr_in_eax=0
+SYM_CODE_START_NOALIGN(\name)
+       pushl %eax
+       pushl %ecx
+       pushl %edx
+
+       .if \put_ret_addr_in_eax
+       /* Place EIP in the arg1 */
+       movl 3*4(%esp), %eax
+       .endif
+
+       call \func
+       popl %edx
+       popl %ecx
+       popl %eax
+       RET
+       _ASM_NOKPROBE(\name)
+SYM_CODE_END(\name)
+       .endm
+
+#endif
index 8c8d38f0cb1df0ee959e09c9f912ec1ab2afce40..582731f74dc87d497ddddb408c920abb9c8c4e72 100644 (file)
@@ -7,6 +7,8 @@
 #include <linux/linkage.h>
 #include <asm/msr-index.h>
 
+#include "calling.h"
+
 .pushsection .noinstr.text, "ax"
 
 SYM_FUNC_START(entry_ibpb)
@@ -20,3 +22,5 @@ SYM_FUNC_END(entry_ibpb)
 EXPORT_SYMBOL_GPL(entry_ibpb);
 
 .popsection
+
+THUNK warn_thunk_thunk, __warn_thunk
index 567d973eed0381810ed276a5b8c8561573a13374..1f09b1e3edebbfc070ee740cd3eb43f65b17d81f 100644 (file)
@@ -562,7 +562,7 @@ SYM_INNER_LABEL(swapgs_restore_regs_and_return_to_usermode, SYM_L_GLOBAL)
 #ifdef CONFIG_XEN_PV
        ALTERNATIVE "", "jmp xenpv_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV
 #endif
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        ALTERNATIVE "", "jmp .Lpti_restore_regs_and_return_to_usermode", X86_FEATURE_PTI
 #endif
 
@@ -578,7 +578,7 @@ SYM_INNER_LABEL(swapgs_restore_regs_and_return_to_usermode, SYM_L_GLOBAL)
        jnz     .Lnative_iret
        ud2
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 .Lpti_restore_regs_and_return_to_usermode:
        POP_REGS pop_rdi=0
 
@@ -1096,7 +1096,7 @@ SYM_CODE_END(error_return)
  *
  * Registers:
  *     %r14: Used to save/restore the CR3 of the interrupted context
- *           when PAGE_TABLE_ISOLATION is in use.  Do not clobber.
+ *           when MITIGATION_PAGE_TABLE_ISOLATION is in use.  Do not clobber.
  */
 SYM_CODE_START(asm_exc_nmi)
        UNWIND_HINT_IRET_ENTRY
index 0103e103a6573adab040c4e41b588edcdf7a7ecd..da37f42f45498d8282f2ea805d04eec1bfbfaa44 100644 (file)
@@ -4,33 +4,15 @@
  * Copyright 2008 by Steven Rostedt, Red Hat, Inc
  *  (inspired by Andi Kleen's thunk_64.S)
  */
-       #include <linux/export.h>
-       #include <linux/linkage.h>
-       #include <asm/asm.h>
 
-       /* put return address in eax (arg1) */
-       .macro THUNK name, func, put_ret_addr_in_eax=0
-SYM_CODE_START_NOALIGN(\name)
-       pushl %eax
-       pushl %ecx
-       pushl %edx
+#include <linux/export.h>
+#include <linux/linkage.h>
+#include <asm/asm.h>
 
-       .if \put_ret_addr_in_eax
-       /* Place EIP in the arg1 */
-       movl 3*4(%esp), %eax
-       .endif
+#include "calling.h"
 
-       call \func
-       popl %edx
-       popl %ecx
-       popl %eax
-       RET
-       _ASM_NOKPROBE(\name)
-SYM_CODE_END(\name)
-       .endm
-
-       THUNK preempt_schedule_thunk, preempt_schedule
-       THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace
-       EXPORT_SYMBOL(preempt_schedule_thunk)
-       EXPORT_SYMBOL(preempt_schedule_notrace_thunk)
+THUNK preempt_schedule_thunk, preempt_schedule
+THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace
+EXPORT_SYMBOL(preempt_schedule_thunk)
+EXPORT_SYMBOL(preempt_schedule_notrace_thunk)
 
index 416b400f39dbb6b16694a6e76b22bb03e8834bc5..119ebdc3d362398092736e7132f16c0c89e97c5a 100644 (file)
@@ -9,39 +9,6 @@
 #include "calling.h"
 #include <asm/asm.h>
 
-       /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
-       .macro THUNK name, func
-SYM_FUNC_START(\name)
-       pushq %rbp
-       movq %rsp, %rbp
-
-       pushq %rdi
-       pushq %rsi
-       pushq %rdx
-       pushq %rcx
-       pushq %rax
-       pushq %r8
-       pushq %r9
-       pushq %r10
-       pushq %r11
-
-       call \func
-
-       popq %r11
-       popq %r10
-       popq %r9
-       popq %r8
-       popq %rax
-       popq %rcx
-       popq %rdx
-       popq %rsi
-       popq %rdi
-       popq %rbp
-       RET
-SYM_FUNC_END(\name)
-       _ASM_NOKPROBE(\name)
-       .endm
-
 THUNK preempt_schedule_thunk, preempt_schedule
 THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace
 EXPORT_SYMBOL(preempt_schedule_thunk)
index b1b8dd1608f7ebd73510cb94e2866c09aac825b6..c4df99aa16158a10a3076e87fd0785186778bf95 100644 (file)
@@ -87,7 +87,7 @@ CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
        -fno-omit-frame-pointer -foptimize-sibling-calls \
        -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO
 
-ifdef CONFIG_RETPOLINE
+ifdef CONFIG_MITIGATION_RETPOLINE
 ifneq ($(RETPOLINE_VDSO_CFLAGS),)
   CFL += $(RETPOLINE_VDSO_CFLAGS)
 endif
@@ -164,7 +164,7 @@ KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls)
 KBUILD_CFLAGS_32 += -fno-omit-frame-pointer
 KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
 
-ifdef CONFIG_RETPOLINE
+ifdef CONFIG_MITIGATION_RETPOLINE
 ifneq ($(RETPOLINE_VDSO_CFLAGS),)
   KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS)
 endif
index fb7702d4170c554dd9f34737d76ac69e7b07fee0..bf5953883ec365377fec5979f6d5c34418ebba32 100644 (file)
@@ -18,7 +18,7 @@ struct pcpu_hot {
                        struct task_struct      *current_task;
                        int                     preempt_count;
                        int                     cpu_number;
-#ifdef CONFIG_CALL_DEPTH_TRACKING
+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
                        u64                     call_depth;
 #endif
                        unsigned long           top_of_stack;
index 702d93fdd10e8d44015cc687cb90106ae5bd422c..36d0c1e05e608afcee144516f087fd8ef264ad62 100644 (file)
 # define DISABLE_LA57  (1<<(X86_FEATURE_LA57 & 31))
 #endif
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 # define DISABLE_PTI           0
 #else
 # define DISABLE_PTI           (1 << (X86_FEATURE_PTI & 31))
 #endif
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 # define DISABLE_RETPOLINE     0
 #else
 # define DISABLE_RETPOLINE     ((1 << (X86_FEATURE_RETPOLINE & 31)) | \
                                 (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))
 #endif
 
-#ifdef CONFIG_CPU_UNRET_ENTRY
+#ifdef CONFIG_MITIGATION_UNRET_ENTRY
 # define DISABLE_UNRET         0
 #else
 # define DISABLE_UNRET         (1 << (X86_FEATURE_UNRET & 31))
 #endif
 
-#ifdef CONFIG_CALL_DEPTH_TRACKING
+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
 # define DISABLE_CALL_DEPTH_TRACKING   0
 #else
 # define DISABLE_CALL_DEPTH_TRACKING   (1 << (X86_FEATURE_CALL_DEPTH & 31))
index 571fe4d2d2328c3b4899faf8085e0181403ed003..dc31b13b87a0d17020aaf2d3915da366b1b62d59 100644 (file)
 
 #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_RETPOLINE */
-#ifdef CONFIG_SLS
+#else /* CONFIG_MITIGATION_RETPOLINE */
+#ifdef CONFIG_MITIGATION_SLS
 #define RET    ret; int3
 #else
 #define RET    ret
 #endif
-#endif /* CONFIG_RETPOLINE */
+#endif /* CONFIG_MITIGATION_RETPOLINE */
 
 #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_RETPOLINE */
-#ifdef CONFIG_SLS
+#else /* CONFIG_MITIGATION_RETPOLINE */
+#ifdef CONFIG_MITIGATION_SLS
 #define ASM_RET        "ret; int3\n\t"
 #else
 #define ASM_RET        "ret\n\t"
 #endif
-#endif /* CONFIG_RETPOLINE */
+#endif /* CONFIG_MITIGATION_RETPOLINE */
 
 #endif /* __ASSEMBLY__ */
 
index 691ff1ef701b623b8d671ea89b9b258cd25562be..8bd8ed576f91fc4424a2013dca4c9b23a4681a89 100644 (file)
@@ -73,7 +73,7 @@
 # define CALL_THUNKS_DEBUG_INC_CTXSW
 #endif
 
-#if defined(CONFIG_CALL_DEPTH_TRACKING) && !defined(COMPILE_OFFSETS)
+#if defined(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) && !defined(COMPILE_OFFSETS)
 
 #include <asm/asm-offsets.h>
 
  */
 .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_MITIGATION_SRSO))
        ANNOTATE_RETPOLINE_SAFE
        nop
 #endif
  * instruction irrespective of kCFI.
  */
 .macro JMP_NOSPEC reg:req
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        __CS_PREFIX \reg
        jmp     __x86_indirect_thunk_\reg
 #else
 .endm
 
 .macro CALL_NOSPEC reg:req
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        __CS_PREFIX \reg
        call    __x86_indirect_thunk_\reg
 #else
 .Lskip_rsb_\@:
 .endm
 
-#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)
+#if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO)
 #define CALL_UNTRAIN_RET       "call entry_untrain_ret"
 #else
 #define CALL_UNTRAIN_RET       ""
  * where we have a stack but before any RET instruction.
  */
 .macro __UNTRAIN_RET ibpb_feature, call_depth_insns
-#if defined(CONFIG_RETHUNK) || defined(CONFIG_CPU_IBPB_ENTRY)
+#if defined(CONFIG_MITIGATION_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY)
        VALIDATE_UNRET_END
        ALTERNATIVE_3 "",                                               \
                      CALL_UNTRAIN_RET, X86_FEATURE_UNRET,              \
 
 
 .macro CALL_DEPTH_ACCOUNT
-#ifdef CONFIG_CALL_DEPTH_TRACKING
+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
        ALTERNATIVE "",                                                 \
                    __stringify(INCREMENT_CALL_DEPTH), X86_FEATURE_CALL_DEPTH
 #endif
@@ -319,19 +319,19 @@ 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) {}
 #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) {}
 #endif
 
-#ifdef CONFIG_CPU_SRSO
+#ifdef CONFIG_MITIGATION_SRSO
 extern void srso_return_thunk(void);
 extern void srso_alias_return_thunk(void);
 #else
@@ -348,7 +348,9 @@ extern void entry_ibpb(void);
 
 extern void (*x86_return_thunk)(void);
 
-#ifdef CONFIG_CALL_DEPTH_TRACKING
+extern void __warn_thunk(void);
+
+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
 extern void call_depth_return_thunk(void);
 
 #define CALL_DEPTH_ACCOUNT                                     \
@@ -362,14 +364,14 @@ DECLARE_PER_CPU(u64, __x86_ret_count);
 DECLARE_PER_CPU(u64, __x86_stuffs_count);
 DECLARE_PER_CPU(u64, __x86_ctxsw_count);
 #endif
-#else /* !CONFIG_CALL_DEPTH_TRACKING */
+#else /* !CONFIG_MITIGATION_CALL_DEPTH_TRACKING */
 
 static inline void call_depth_return_thunk(void) {}
 #define CALL_DEPTH_ACCOUNT ""
 
-#endif /* CONFIG_CALL_DEPTH_TRACKING */
+#endif /* CONFIG_MITIGATION_CALL_DEPTH_TRACKING */
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 
 #define GEN(reg) \
        extern retpoline_thunk_t __x86_indirect_thunk_ ## reg;
@@ -390,7 +392,7 @@ static inline void call_depth_return_thunk(void) {}
 
 /*
  * Inline asm uses the %V modifier which is only in newer GCC
- * which is ensured when CONFIG_RETPOLINE is defined.
+ * which is ensured when CONFIG_MITIGATION_RETPOLINE is defined.
  */
 # define CALL_NOSPEC                                           \
        ALTERNATIVE_2(                                          \
index c7ec5bb88334eab119ccf78002be2e7679291113..dcd836b59bebd329c3d265b98e48ef6eb4c9e6fc 100644 (file)
@@ -34,7 +34,7 @@ static inline void paravirt_release_p4d(unsigned long pfn) {}
  */
 extern gfp_t __userpte_alloc_gfp;
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 /*
  * Instead of one PGD, we acquire two PGDs.  Being order-1, it is
  * both 8k in size and 8k-aligned.  That lets us just flip bit 12
index 9e7c0b719c3c11361b60f51cb79a553322afeb76..dabafba957ea6f2e1d5d6796da07427dab2f22ba 100644 (file)
@@ -52,7 +52,7 @@ static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
 
 static inline void native_set_pud(pud_t *pudp, pud_t pud)
 {
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        pud.p4d.pgd = pti_set_user_pgtbl(&pudp->p4d.pgd, pud.p4d.pgd);
 #endif
        pxx_xchg64(pud, pudp, native_pud_val(pud));
index 9d077bca6a103ecfcbd02424483fd5971995bafd..df0f7d4a96f3284eb4ac9c0495b5a4ec8df27aa3 100644 (file)
@@ -909,7 +909,7 @@ static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
 pmd_t *populate_extra_pmd(unsigned long vaddr);
 pte_t *populate_extra_pte(unsigned long vaddr);
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 pgd_t __pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd);
 
 /*
@@ -923,12 +923,12 @@ static inline pgd_t pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd)
                return pgd;
        return __pti_set_user_pgtbl(pgdp, pgd);
 }
-#else   /* CONFIG_PAGE_TABLE_ISOLATION */
+#else   /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */
 static inline pgd_t pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd)
 {
        return pgd;
 }
-#endif  /* CONFIG_PAGE_TABLE_ISOLATION */
+#endif  /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */
 
 #endif /* __ASSEMBLY__ */
 
@@ -1131,7 +1131,7 @@ static inline int p4d_bad(p4d_t p4d)
 {
        unsigned long ignore_flags = _KERNPG_TABLE | _PAGE_USER;
 
-       if (IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION))
+       if (IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION))
                ignore_flags |= _PAGE_NX;
 
        return (p4d_flags(p4d) & ~ignore_flags) != 0;
@@ -1177,7 +1177,7 @@ static inline int pgd_bad(pgd_t pgd)
        if (!pgtable_l5_enabled())
                return 0;
 
-       if (IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION))
+       if (IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION))
                ignore_flags |= _PAGE_NX;
 
        return (pgd_flags(pgd) & ~ignore_flags) != _KERNPG_TABLE;
@@ -1422,9 +1422,9 @@ static inline bool pgdp_maps_userspace(void *__ptr)
 #define pgd_leaf       pgd_large
 static inline int pgd_large(pgd_t pgd) { return 0; }
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 /*
- * All top-level PAGE_TABLE_ISOLATION page tables are order-1 pages
+ * All top-level MITIGATION_PAGE_TABLE_ISOLATION page tables are order-1 pages
  * (8k-aligned and 8k in size).  The kernel one is at the beginning 4k and
  * the user one is in the last 4k.  To switch between them, you
  * just need to flip the 12th bit in their addresses.
@@ -1469,7 +1469,7 @@ static inline p4d_t *user_to_kernel_p4dp(p4d_t *p4dp)
 {
        return ptr_clear_bit(p4dp, PTI_PGTABLE_SWITCH_BIT);
 }
-#endif /* CONFIG_PAGE_TABLE_ISOLATION */
+#endif /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */
 
 /*
  * clone_pgd_range(pgd_t *dst, pgd_t *src, int count);
@@ -1484,7 +1484,7 @@ static inline p4d_t *user_to_kernel_p4dp(p4d_t *p4dp)
 static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
 {
        memcpy(dst, src, count * sizeof(pgd_t));
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        if (!static_cpu_has(X86_FEATURE_PTI))
                return;
        /* Clone the user space pgd as well */
index 24af25b1551a56597c988019b90e545db52442ff..7e9db77231ac7f596182b2f259c2798fbaf20f30 100644 (file)
@@ -143,7 +143,8 @@ static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d)
 {
        pgd_t pgd;
 
-       if (pgtable_l5_enabled() || !IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION)) {
+       if (pgtable_l5_enabled() ||
+           !IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION)) {
                WRITE_ONCE(*p4dp, p4d);
                return;
        }
index d8cccadc83a6fb3d512df090538ac6bd1df23318..e5f204b9b33dfaa92ed1b05faa6b604e50d5f2f3 100644 (file)
@@ -51,7 +51,7 @@
 #define CR3_NOFLUSH    0
 #endif
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 # define X86_CR3_PTI_PCID_USER_BIT     11
 #endif
 
index 07375b476c4fda6cfd89229826bf21e331ef5190..ab167c96b9ab474b33d778453db0bb550f42b0ac 100644 (file)
@@ -3,7 +3,7 @@
 #define _ASM_X86_PTI_H
 #ifndef __ASSEMBLY__
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 extern void pti_init(void);
 extern void pti_check_boottime_disable(void);
 extern void pti_finalize(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 e7aeae02aacaf6a63deb7ac065fc1bbca5e049a3..ff6e32ec8259c278a743da1482c2329cbf15a846 100644 (file)
@@ -544,7 +544,7 @@ static inline bool is_jcc32(struct insn *insn)
        return insn->opcode.bytes[0] == 0x0f && (insn->opcode.bytes[1] & 0xf0) == 0x80;
 }
 
-#if defined(CONFIG_RETPOLINE) && defined(CONFIG_OBJTOOL)
+#if defined(CONFIG_MITIGATION_RETPOLINE) && defined(CONFIG_OBJTOOL)
 
 /*
  * CALL/JMP *%\reg
@@ -708,8 +708,8 @@ static int patch_retpoline(void *addr, struct insn *insn, u8 *bytes)
        /*
         * The compiler is supposed to EMIT an INT3 after every unconditional
         * JMP instruction due to AMD BTC. However, if the compiler is too old
-        * or SLS isn't enabled, we still need an INT3 after indirect JMPs
-        * even on Intel.
+        * or MITIGATION_SLS isn't enabled, we still need an INT3 after
+        * indirect JMPs even on Intel.
         */
        if (op == JMP32_INSN_OPCODE && i < insn->length)
                bytes[i++] = INT3_INSN_OPCODE;
@@ -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,14 +842,14 @@ 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_RETPOLINE || !CONFIG_OBJTOOL */
+#else /* !CONFIG_MITIGATION_RETPOLINE || !CONFIG_OBJTOOL */
 
 void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) { }
 void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
 
-#endif /* CONFIG_RETPOLINE && CONFIG_OBJTOOL */
+#endif /* CONFIG_MITIGATION_RETPOLINE && CONFIG_OBJTOOL */
 
 #ifdef CONFIG_X86_KERNEL_IBT
 
index 6913b372ccf764e1345f33df8395f2ebb0eb206a..a98020bf31bb465c1444b49cd8a5c7ebe21f973b 100644 (file)
@@ -109,7 +109,7 @@ static void __used common(void)
        OFFSET(TSS_sp2, tss_struct, x86_tss.sp2);
        OFFSET(X86_top_of_stack, pcpu_hot, top_of_stack);
        OFFSET(X86_current_task, pcpu_hot, current_task);
-#ifdef CONFIG_CALL_DEPTH_TRACKING
+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
        OFFSET(X86_call_depth, pcpu_hot, call_depth);
 #endif
 #if IS_ENABLED(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64)
index f3abca334199d8eae235f1560f99448eb9675a27..310fea1af124a09d20f9e4542b76ad026dac5314 100644 (file)
@@ -941,7 +941,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 bb0ab8466b919809a861d7a2f979e132ad863289..a78892b0f82312211787841b18068551f3f37adc 100644 (file)
@@ -671,7 +671,7 @@ enum gds_mitigations {
        GDS_MITIGATION_HYPERVISOR,
 };
 
-#if IS_ENABLED(CONFIG_GDS_FORCE_MITIGATION)
+#if IS_ENABLED(CONFIG_MITIGATION_GDS_FORCE)
 static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FORCE;
 #else
 static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FULL;
@@ -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;
@@ -994,24 +994,24 @@ static void __init retbleed_select_mitigation(void)
                if (!boot_cpu_has(X86_FEATURE_IBPB)) {
                        pr_err("WARNING: CPU does not support IBPB.\n");
                        goto do_cmd_auto;
-               } else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY)) {
+               } else if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) {
                        retbleed_mitigation = RETBLEED_MITIGATION_IBPB;
                } else {
-                       pr_err("WARNING: kernel not compiled with CPU_IBPB_ENTRY.\n");
+                       pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n");
                        goto do_cmd_auto;
                }
                break;
 
        case RETBLEED_CMD_STUFF:
-               if (IS_ENABLED(CONFIG_CALL_DEPTH_TRACKING) &&
+               if (IS_ENABLED(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) &&
                    spectre_v2_enabled == SPECTRE_V2_RETPOLINE) {
                        retbleed_mitigation = RETBLEED_MITIGATION_STUFF;
 
                } else {
-                       if (IS_ENABLED(CONFIG_CALL_DEPTH_TRACKING))
+                       if (IS_ENABLED(CONFIG_MITIGATION_CALL_DEPTH_TRACKING))
                                pr_err("WARNING: retbleed=stuff depends on spectre_v2=retpoline\n");
                        else
-                               pr_err("WARNING: kernel not compiled with CALL_DEPTH_TRACKING.\n");
+                               pr_err("WARNING: kernel not compiled with MITIGATION_CALL_DEPTH_TRACKING.\n");
 
                        goto do_cmd_auto;
                }
@@ -1021,9 +1021,10 @@ 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_CPU_IBPB_ENTRY) && boot_cpu_has(X86_FEATURE_IBPB))
+                       else if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY) &&
+                                boot_cpu_has(X86_FEATURE_IBPB))
                                retbleed_mitigation = RETBLEED_MITIGATION_IBPB;
                }
 
@@ -1102,7 +1103,7 @@ static enum spectre_v2_user_mitigation spectre_v2_user_stibp __ro_after_init =
 static enum spectre_v2_user_mitigation spectre_v2_user_ibpb __ro_after_init =
        SPECTRE_V2_USER_NONE;
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 static bool spectre_v2_bad_module;
 
 bool retpoline_module_ok(bool has_retpoline)
@@ -1415,7 +1416,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
             cmd == SPECTRE_V2_CMD_RETPOLINE_GENERIC ||
             cmd == SPECTRE_V2_CMD_EIBRS_LFENCE ||
             cmd == SPECTRE_V2_CMD_EIBRS_RETPOLINE) &&
-           !IS_ENABLED(CONFIG_RETPOLINE)) {
+           !IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {
                pr_err("%s selected but not compiled in. Switching to AUTO select\n",
                       mitigation_options[i].option);
                return SPECTRE_V2_CMD_AUTO;
@@ -1438,7 +1439,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
                return SPECTRE_V2_CMD_AUTO;
        }
 
-       if (cmd == SPECTRE_V2_CMD_IBRS && !IS_ENABLED(CONFIG_CPU_IBRS_ENTRY)) {
+       if (cmd == SPECTRE_V2_CMD_IBRS && !IS_ENABLED(CONFIG_MITIGATION_IBRS_ENTRY)) {
                pr_err("%s selected but not compiled in. Switching to AUTO select\n",
                       mitigation_options[i].option);
                return SPECTRE_V2_CMD_AUTO;
@@ -1469,7 +1470,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
 
 static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)
 {
-       if (!IS_ENABLED(CONFIG_RETPOLINE)) {
+       if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {
                pr_err("Kernel not compiled with retpoline; no mitigation available!");
                return SPECTRE_V2_NONE;
        }
@@ -1564,7 +1565,7 @@ static void __init spectre_v2_select_mitigation(void)
                        break;
                }
 
-               if (IS_ENABLED(CONFIG_CPU_IBRS_ENTRY) &&
+               if (IS_ENABLED(CONFIG_MITIGATION_IBRS_ENTRY) &&
                    boot_cpu_has_bug(X86_BUG_RETBLEED) &&
                    retbleed_cmd != RETBLEED_CMD_OFF &&
                    retbleed_cmd != RETBLEED_CMD_STUFF &&
@@ -2457,7 +2458,7 @@ static void __init srso_select_mitigation(void)
                break;
 
        case SRSO_CMD_SAFE_RET:
-               if (IS_ENABLED(CONFIG_CPU_SRSO)) {
+               if (IS_ENABLED(CONFIG_MITIGATION_SRSO)) {
                        /*
                         * Enable the return thunk for generated code
                         * like ftrace, static_call, etc.
@@ -2477,29 +2478,29 @@ static void __init srso_select_mitigation(void)
                        else
                                srso_mitigation = SRSO_MITIGATION_SAFE_RET_UCODE_NEEDED;
                } else {
-                       pr_err("WARNING: kernel not compiled with CPU_SRSO.\n");
+                       pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");
                }
                break;
 
        case SRSO_CMD_IBPB:
-               if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY)) {
+               if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) {
                        if (has_microcode) {
                                setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB);
                                srso_mitigation = SRSO_MITIGATION_IBPB;
                        }
                } else {
-                       pr_err("WARNING: kernel not compiled with CPU_IBPB_ENTRY.\n");
+                       pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n");
                }
                break;
 
        case SRSO_CMD_IBPB_ON_VMEXIT:
-               if (IS_ENABLED(CONFIG_CPU_SRSO)) {
+               if (IS_ENABLED(CONFIG_MITIGATION_SRSO)) {
                        if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) {
                                setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
                                srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT;
                        }
                } else {
-                       pr_err("WARNING: kernel not compiled with CPU_SRSO.\n");
+                       pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");
                 }
                break;
        }
@@ -2849,3 +2850,8 @@ ssize_t cpu_show_gds(struct device *dev, struct device_attribute *attr, char *bu
        return cpu_show_common(dev, attr, buf, X86_BUG_GDS);
 }
 #endif
+
+void __warn_thunk(void)
+{
+       WARN_ONCE(1, "Unpatched return thunk in use. This should not happen!\n");
+}
index f18ca44c904b747e68a3fdf0f7926a7025da71b7..44a91ef5a23b8e20247fd82d03aa2e046c147426 100644 (file)
@@ -410,7 +410,7 @@ static void __die_header(const char *str, struct pt_regs *regs, long err)
               IS_ENABLED(CONFIG_SMP)     ? " SMP"             : "",
               debug_pagealloc_enabled()  ? " DEBUG_PAGEALLOC" : "",
               IS_ENABLED(CONFIG_KASAN)   ? " KASAN"           : "",
-              IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION) ?
+              IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION) ?
               (boot_cpu_has(X86_FEATURE_PTI) ? " PTI" : " NOPTI") : "");
 }
 NOKPROBE_SYMBOL(__die_header);
index 12df54ff0e817188d384affee8d98a515d6db471..70139d9d2e017316f7e7d015b52aeb86f7f1c580 100644 (file)
@@ -307,7 +307,8 @@ union ftrace_op_code_union {
        } __attribute__((packed));
 };
 
-#define RET_SIZE               (IS_ENABLED(CONFIG_RETPOLINE) ? 5 : 1 + IS_ENABLED(CONFIG_SLS))
+#define RET_SIZE \
+       (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) ? 5 : 1 + IS_ENABLED(CONFIG_MITIGATION_SLS))
 
 static unsigned long
 create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
index 487ac57e2c81fbcdfc80ac67c40db2826c69ec05..b50f3641c4d6de0d576efca319432640cf83cd08 100644 (file)
@@ -414,7 +414,7 @@ __REFDATA
        .align 4
 SYM_DATA(initial_code,         .long i386_start_kernel)
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 #define        PGD_ALIGN       (2 * PAGE_SIZE)
 #define PTI_USER_PGD_FILL      1024
 #else
@@ -474,7 +474,7 @@ SYM_DATA_START(initial_page_table)
 # endif
        .align PAGE_SIZE                /* needs to be page-sized too */
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        /*
         * PTI needs another page so sync_initial_pagetable() works correctly
         * and does not scribble over the data which is placed behind the
index bb8ee1ce696836667caa5700b4bcce6cb2ab5488..cc3a81852e4acbe759e3d156722ac9959a2ad1d7 100644 (file)
@@ -622,7 +622,7 @@ SYM_CODE_END(vc_no_ghcb)
 #define SYM_DATA_START_PAGE_ALIGNED(name)                      \
        SYM_START(name, SYM_L_GLOBAL, .balign PAGE_SIZE)
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 /*
  * Each PGD needs to be 8k long and 8k aligned.  We do not
  * ever go out to userspace with these, so we do not
index 517821b48391aadf63b49d42783dd7f09f5f2bfa..36d6809c6c9e1a74d879285bd835958087c1a5ee 100644 (file)
@@ -324,7 +324,7 @@ static int can_optimize(unsigned long paddr)
                 * However, the kernel built with retpolines or IBT has jump
                 * tables disabled so the check can be skipped altogether.
                 */
-               if (!IS_ENABLED(CONFIG_RETPOLINE) &&
+               if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) &&
                    !IS_ENABLED(CONFIG_X86_KERNEL_IBT) &&
                    insn_is_indirect_jump(&insn))
                        return 0;
index 7a814b41402de551041f24e4fc96047d780d816c..0f19ef355f5f1ffb5eba0f5fd25351263ea9fd3b 100644 (file)
@@ -184,7 +184,7 @@ static struct ldt_struct *alloc_ldt_struct(unsigned int num_entries)
        return new_ldt;
 }
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 
 static void do_sanity_check(struct mm_struct *mm,
                            bool had_kernel_mapping,
@@ -377,7 +377,7 @@ static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt)
        flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, PAGE_SHIFT, false);
 }
 
-#else /* !CONFIG_PAGE_TABLE_ISOLATION */
+#else /* !CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */
 
 static int
 map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
@@ -388,11 +388,11 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
 static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt)
 {
 }
-#endif /* CONFIG_PAGE_TABLE_ISOLATION */
+#endif /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */
 
 static void free_ldt_pgtables(struct mm_struct *mm)
 {
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        struct mmu_gather tlb;
        unsigned long start = LDT_BASE_ADDR;
        unsigned long end = LDT_END_ADDR;
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 9be175c8ac975b46c61ebb75a47160fb6bf1deb1..56451fd2099e718b6cf89fde074980042aa3096a 100644 (file)
@@ -133,7 +133,7 @@ SECTIONS
                LOCK_TEXT
                KPROBES_TEXT
                SOFTIRQENTRY_TEXT
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
                *(.text..__x86.indirect_thunk)
                *(.text..__x86.return_thunk)
 #endif
@@ -143,7 +143,7 @@ SECTIONS
                *(.text..__x86.rethunk_untrain)
                ENTRY_TEXT
 
-#ifdef CONFIG_CPU_SRSO
+#ifdef CONFIG_MITIGATION_SRSO
                /*
                 * See the comment above srso_alias_untrain_ret()'s
                 * definition.
@@ -268,7 +268,7 @@ SECTIONS
        }
 #endif
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        /*
         * List of instructions that call/jmp/jcc to retpoline thunks
         * __x86_indirect_thunk_*(). These instructions can be patched along
@@ -505,11 +505,11 @@ 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
 
-#ifdef CONFIG_CPU_SRSO
+#ifdef CONFIG_MITIGATION_SRSO
 . = ASSERT((srso_safe_ret & 0x3f) == 0, "srso_safe_ret not cacheline-aligned");
 /*
  * GNU ld cannot do XOR until 2.41.
index 2d6cdeab1f8a3e78306148d44a4665a1d51d8b1e..d59e3ba5d6463ec36199b437f40f78ecfbdf8d83 100644 (file)
@@ -263,7 +263,7 @@ static unsigned long get_guest_cr3(struct kvm_vcpu *vcpu)
 static inline unsigned long kvm_mmu_get_guest_pgd(struct kvm_vcpu *vcpu,
                                                  struct kvm_mmu *mmu)
 {
-       if (IS_ENABLED(CONFIG_RETPOLINE) && mmu->get_guest_pgd == get_guest_cr3)
+       if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && mmu->get_guest_pgd == get_guest_cr3)
                return kvm_read_cr3(vcpu);
 
        return mmu->get_guest_pgd(vcpu);
index 0669a8a668cacd4d0be68affbecbb686524c5213..5390a591a5718cce422958210e3eb91f457bd169 100644 (file)
@@ -315,7 +315,7 @@ static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
        if (!prefetch)
                vcpu->stat.pf_taken++;
 
-       if (IS_ENABLED(CONFIG_RETPOLINE) && fault.is_tdp)
+       if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && fault.is_tdp)
                r = kvm_tdp_page_fault(vcpu, &fault);
        else
                r = vcpu->arch.mmu->page_fault(vcpu, &fault);
index e90b429c84f158bdd8d4348172d56eac1e80763b..61f2bdc9f4f8b294c3db3486637f9d1e5c3b428b 100644 (file)
@@ -3455,7 +3455,7 @@ int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code)
        if (!svm_check_exit_valid(exit_code))
                return svm_handle_invalid_exit(vcpu, exit_code);
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        if (exit_code == SVM_EXIT_MSR)
                return msr_interception(vcpu);
        else if (exit_code == SVM_EXIT_VINTR)
index 9499f9c6b07711bb1254ce574584ebc166d293fc..187018c424bfb4ba8cadfa71a0f4ec7d4c63d766 100644 (file)
@@ -207,7 +207,7 @@ SYM_FUNC_START(__svm_vcpu_run)
 7:     vmload %_ASM_AX
 8:
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
        FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
 #endif
@@ -344,7 +344,7 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run)
        /* Pop @svm to RDI, guest registers have been saved already. */
        pop %_ASM_DI
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
        FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
 #endif
index 1111d9d089038b2f17b372891a235222b74f87bf..ebf11ef59f03c612b7ae48ebeee97519f9eb59eb 100644 (file)
@@ -6543,7 +6543,7 @@ static int __vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
 
        if (exit_reason.basic >= kvm_vmx_max_exit_handlers)
                goto unexpected_vmexit;
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        if (exit_reason.basic == EXIT_REASON_MSR_WRITE)
                return kvm_emulate_wrmsr(vcpu);
        else if (exit_reason.basic == EXIT_REASON_PREEMPTION_TIMER)
index ea3a28e7b613ccbda58490702c6609057412e4c0..72cc9c90e9f307fa0ec2d9f225c4b43548c041bc 100644 (file)
@@ -49,7 +49,7 @@ lib-$(CONFIG_ARCH_HAS_COPY_MC) += copy_mc.o copy_mc_64.o
 lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o insn-eval.o
 lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
 lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
-lib-$(CONFIG_RETPOLINE) += retpoline.o
+lib-$(CONFIG_MITIGATION_RETPOLINE) += retpoline.o
 
 obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o
 obj-y += iomem.o
index 7b2589877d065fd1e511ceb98e176a6bfd236b5e..721b528da9acee3e4eb2168bbd65ab7303a4db3a 100644 (file)
@@ -71,7 +71,7 @@ SYM_CODE_END(__x86_indirect_thunk_array)
 #include <asm/GEN-for-each-reg.h>
 #undef GEN
 
-#ifdef CONFIG_CALL_DEPTH_TRACKING
+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
 .macro CALL_THUNK reg
        .align RETPOLINE_THUNK_SIZE
 
@@ -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
@@ -138,7 +138,7 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array)
  */
        .section .text..__x86.return_thunk
 
-#ifdef CONFIG_CPU_SRSO
+#ifdef CONFIG_MITIGATION_SRSO
 
 /*
  * srso_alias_untrain_ret() and srso_alias_safe_ret() are placed at
@@ -225,12 +225,12 @@ SYM_CODE_END(srso_return_thunk)
 
 #define JMP_SRSO_UNTRAIN_RET "jmp srso_untrain_ret"
 #define JMP_SRSO_ALIAS_UNTRAIN_RET "jmp srso_alias_untrain_ret"
-#else /* !CONFIG_CPU_SRSO */
+#else /* !CONFIG_MITIGATION_SRSO */
 #define JMP_SRSO_UNTRAIN_RET "ud2"
 #define JMP_SRSO_ALIAS_UNTRAIN_RET "ud2"
-#endif /* CONFIG_CPU_SRSO */
+#endif /* CONFIG_MITIGATION_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_MITIGATION_SRSO)
 
 SYM_FUNC_START(entry_untrain_ret)
        ALTERNATIVE_2 JMP_RETBLEED_UNTRAIN_RET,                         \
@@ -325,9 +325,9 @@ 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_MITIGATION_SRSO */
 
-#ifdef CONFIG_CALL_DEPTH_TRACKING
+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
 
        .align 64
 SYM_FUNC_START(call_depth_return_thunk)
@@ -359,7 +359,7 @@ SYM_FUNC_START(call_depth_return_thunk)
        int3
 SYM_FUNC_END(call_depth_return_thunk)
 
-#endif /* CONFIG_CALL_DEPTH_TRACKING */
+#endif /* CONFIG_MITIGATION_CALL_DEPTH_TRACKING */
 
 /*
  * This function name is magical and is used by -mfunction-return=thunk-extern
@@ -369,21 +369,18 @@ SYM_FUNC_END(call_depth_return_thunk)
  * 'JMP __x86_return_thunk' sites are changed to something else by
  * apply_returns().
  *
- * This should be converted eventually to call a warning function which
- * should scream loudly when the default return thunk is called after
- * alternatives have been applied.
- *
- * That warning function cannot BUG() because the bug splat cannot be
- * displayed in all possible configurations, leading to users not really
- * knowing why the machine froze.
+ * The ALTERNATIVE below adds a really loud warning to catch the case
+ * where the insufficient default return thunk ends up getting used for
+ * whatever reason like miscompilation or failure of
+ * objtool/alternatives/etc to patch all the return sites.
  */
 SYM_CODE_START(__x86_return_thunk)
        UNWIND_HINT_FUNC
        ANNOTATE_NOENDBR
-       ANNOTATE_UNRET_SAFE
-       ret
+       ALTERNATIVE __stringify(ANNOTATE_UNRET_SAFE; ret), \
+                  "jmp warn_thunk_thunk", X86_FEATURE_ALWAYS
        int3
 SYM_CODE_END(__x86_return_thunk)
 EXPORT_SYMBOL(__x86_return_thunk)
 
-#endif /* CONFIG_RETHUNK */
+#endif /* CONFIG_MITIGATION_RETHUNK */
index c80febc44cd2feed47bf3c419accb98b12c1e38b..031cd10ed17fcecc26cf8c3fc421ae98bed70be6 100644 (file)
@@ -60,7 +60,7 @@ obj-$(CONFIG_NUMA_EMU)                += numa_emulation.o
 
 obj-$(CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS) += pkeys.o
 obj-$(CONFIG_RANDOMIZE_MEMORY)                 += kaslr.o
-obj-$(CONFIG_PAGE_TABLE_ISOLATION)             += pti.o
+obj-$(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION)  += pti.o
 
 obj-$(CONFIG_X86_MEM_ENCRYPT)  += mem_encrypt.o
 obj-$(CONFIG_AMD_MEM_ENCRYPT)  += mem_encrypt_amd.o
index b43301cb2a80ca0de4416d8bc51f423eee4a87d1..ae5c213a1cb0064a8a1a26d406aab70ebc031fc4 100644 (file)
@@ -22,7 +22,7 @@ static int ptdump_curknl_show(struct seq_file *m, void *v)
 
 DEFINE_SHOW_ATTRIBUTE(ptdump_curknl);
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 static int ptdump_curusr_show(struct seq_file *m, void *v)
 {
        if (current->mm->pgd)
@@ -54,7 +54,7 @@ static int __init pt_dump_debug_init(void)
        debugfs_create_file("current_kernel", 0400, dir, NULL,
                            &ptdump_curknl_fops);
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        debugfs_create_file("current_user", 0400, dir, NULL,
                            &ptdump_curusr_fops);
 #endif
index e1b599ecbbc26d02c2de09a589f899f0eebca01d..b7b88c1d91ec4698685c9e2e8f49a2f06e343862 100644 (file)
@@ -408,7 +408,7 @@ void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm,
                                   bool user)
 {
        pgd_t *pgd = mm->pgd;
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        if (user && boot_cpu_has(X86_FEATURE_PTI))
                pgd = kernel_to_user_pgdp(pgd);
 #endif
@@ -418,7 +418,7 @@ EXPORT_SYMBOL_GPL(ptdump_walk_pgd_level_debugfs);
 
 void ptdump_walk_user_pgd_level_checkwx(void)
 {
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        pgd_t *pgd = INIT_PGD;
 
        if (!(__supported_pte_mask & _PAGE_NX) ||
index 0cbc1b8e8e3d10185e4e63ff3fab4e0057417f99..cceb779d882d882b4b0d7b80a2f3c6bc33a8e40b 100644 (file)
@@ -293,7 +293,7 @@ static void pgd_mop_up_pmds(struct mm_struct *mm, pgd_t *pgdp)
        for (i = 0; i < PREALLOCATED_PMDS; i++)
                mop_up_one_pmd(mm, &pgdp[i]);
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 
        if (!boot_cpu_has(X86_FEATURE_PTI))
                return;
@@ -325,7 +325,7 @@ static void pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmds[])
        }
 }
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 static void pgd_prepopulate_user_pmd(struct mm_struct *mm,
                                     pgd_t *k_pgd, pmd_t *pmds[])
 {
index 5768d386efab6ece2029b9d6f797c54dc7491220..4af930947380c5378190ccd631290cdcf475a1a1 100644 (file)
 #define CR3_HW_ASID_BITS               12
 
 /*
- * When enabled, PAGE_TABLE_ISOLATION consumes a single bit for
+ * When enabled, MITIGATION_PAGE_TABLE_ISOLATION consumes a single bit for
  * user/kernel switches
  */
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 # define PTI_CONSUMED_PCID_BITS        1
 #else
 # define PTI_CONSUMED_PCID_BITS        0
@@ -114,7 +114,7 @@ static inline u16 kern_pcid(u16 asid)
 {
        VM_WARN_ON_ONCE(asid > MAX_ASID_AVAILABLE);
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        /*
         * Make sure that the dynamic ASID space does not conflict with the
         * bit we are using to switch between user and kernel ASIDs.
@@ -149,7 +149,7 @@ static inline u16 kern_pcid(u16 asid)
 static inline u16 user_pcid(u16 asid)
 {
        u16 ret = kern_pcid(asid);
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
        ret |= 1 << X86_CR3_PTI_PCID_USER_BIT;
 #endif
        return ret;
@@ -262,7 +262,7 @@ static void choose_new_asid(struct mm_struct *next, u64 next_tlb_gen,
 static inline void invalidate_user_asid(u16 asid)
 {
        /* There is no user ASID if address space separation is off */
-       if (!IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION))
+       if (!IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION))
                return;
 
        /*
index 919f647c740fb54f0fca4f4a16c5f614f9cf8521..f3b4716317c1aebc8efb03fb404c4aa92dc2e9cc 100644 (file)
@@ -553,7 +553,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip)
                        emit_jump(&prog, &__x86_indirect_thunk_array[reg], ip);
        } else {
                EMIT2(0xFF, 0xE0 + reg);        /* jmp *%\reg */
-               if (IS_ENABLED(CONFIG_RETPOLINE) || IS_ENABLED(CONFIG_SLS))
+               if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) || IS_ENABLED(CONFIG_MITIGATION_SLS))
                        EMIT1(0xCC);            /* int3 */
        }
 
@@ -568,7 +568,7 @@ static void emit_return(u8 **pprog, u8 *ip)
                emit_jump(&prog, x86_return_thunk, ip);
        } else {
                EMIT1(0xC3);            /* ret */
-               if (IS_ENABLED(CONFIG_SLS))
+               if (IS_ENABLED(CONFIG_MITIGATION_SLS))
                        EMIT1(0xCC);    /* int3 */
        }
 
index b18ce19981ece42e0e8ee1aee9ad6c7a8f1181ab..c10083a8e68e62df31960d724b3bc4c0baca6d06 100644 (file)
@@ -1273,7 +1273,7 @@ static int emit_jmp_edx(u8 **pprog, u8 *ip)
        u8 *prog = *pprog;
        int cnt = 0;
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        EMIT1_off32(0xE9, (u8 *)__x86_indirect_thunk_edx - (ip + 5));
 #else
        EMIT2(0xFF, 0xE2);
index 08aa0f25f12a0fb92b7f9002740c50a1c0f2ad9d..bc31863c5ee6389419cc24250f56d4b89e8ec0e4 100644 (file)
@@ -61,7 +61,7 @@ ifdef CONFIG_STACKPROTECTOR_STRONG
 PURGATORY_CFLAGS_REMOVE                += -fstack-protector-strong
 endif
 
-ifdef CONFIG_RETPOLINE
+ifdef CONFIG_MITIGATION_RETPOLINE
 PURGATORY_CFLAGS_REMOVE                += $(RETPOLINE_CFLAGS)
 endif
 
index c1a963be7d289e6edafba98f1d7d0236ee4f69f1..34ad8bb549a645a7e5682f3d84853e971272763f 100644 (file)
@@ -35,7 +35,7 @@
        (typeof(ptr)) (__ptr + (off));                                  \
 })
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 #define __noretpoline __attribute__((__indirect_branch__("keep")))
 #endif
 
index adb83a42a6b90b03cb468ef2787a568bd8a008d0..35227d47cfc98c14f80a17a01d8df6050c56768e 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef _LINUX_INDIRECT_CALL_WRAPPER_H
 #define _LINUX_INDIRECT_CALL_WRAPPER_H
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 
 /*
  * INDIRECT_CALL_$NR - wrapper for indirect calls with $NR known builtin
index 96bc462872c0ca9fcecfb06a4c68e3f12697d789..1153b0d99a808876f7ba62d137e5095e1e92a954 100644 (file)
@@ -885,7 +885,7 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr,
 static inline void module_bug_cleanup(struct module *mod) {}
 #endif /* CONFIG_GENERIC_BUG */
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 extern bool retpoline_module_ok(bool has_retpoline);
 #else
 static inline bool retpoline_module_ok(bool has_retpoline)
index 33212e93f4a6318493342a541894ec0879a884fa..b3b8d3dab52d5c5b43b390bb5a204226164c2796 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_MITIGATION_SRSO))
 .Lhere_\@:
        .pushsection .discard.validate_unret
        .long   .Lhere_\@ - .
index 1a941efcaa6223a55a8bfcceeb7fb798bbbb1bb4..1fbf9d6c20efb67506aa9e20421f71eed1e313d4 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef _INCLUDE_PTI_H
 #define _INCLUDE_PTI_H
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 #include <asm/pti.h>
 #else
 static inline void pti_init(void) { }
index 780a5f6ad4a671252836e3c53d6aa7eeaa4fef4a..ff27cb2e166207cf8b58a96944d9b07a1779afe3 100644 (file)
@@ -93,7 +93,7 @@ extern const struct nft_set_type nft_set_bitmap_type;
 extern const struct nft_set_type nft_set_pipapo_type;
 extern const struct nft_set_type nft_set_pipapo_avx2_type;
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 bool nft_rhash_lookup(const struct net *net, const struct nft_set *set,
                      const u32 *key, const struct nft_set_ext **ext);
 bool nft_rbtree_lookup(const struct net *net, const struct nft_set *set,
index a608546bcefcf81fa9056dfc567f985c8fccb9b9..ffe58a02537c3ae7979e37ace09373a443d81cc9 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <net/pkt_cls.h>
 
-#if IS_ENABLED(CONFIG_RETPOLINE)
+#if IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)
 
 #include <linux/cpufeature.h>
 #include <linux/static_key.h>
index fd4bfe3ecf014f6b3c83f9a7fa043b7df44dac32..0a9d5984687cb4443499ae1be67630d9578d332f 100644 (file)
@@ -1009,7 +1009,7 @@ static inline u64 rb_time_stamp(struct trace_buffer *buffer)
        u64 ts;
 
        /* Skip retpolines :-( */
-       if (IS_ENABLED(CONFIG_RETPOLINE) && likely(buffer->clock == trace_clock_local))
+       if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && likely(buffer->clock == trace_clock_local))
                ts = trace_clock_local();
        else
                ts = buffer->clock();
index d4958e7e763101e0c27a32d21e456d092bcc9b61..614815a3ed73878212d3860e1d89d582f28c5d2b 100644 (file)
@@ -101,7 +101,7 @@ endif
 endif
 
 ifdef CONFIG_NFT_CT
-ifdef CONFIG_RETPOLINE
+ifdef CONFIG_MITIGATION_RETPOLINE
 nf_tables-objs += nft_ct_fast.o
 endif
 endif
index c3e635364701cf1cc544c6910c2eaddb1281bf29..a48d5f0e2f3e127564107ba87b3982ff865bff8d 100644 (file)
@@ -21,7 +21,7 @@
 #include <net/netfilter/nf_log.h>
 #include <net/netfilter/nft_meta.h>
 
-#if defined(CONFIG_RETPOLINE) && defined(CONFIG_X86)
+#if defined(CONFIG_MITIGATION_RETPOLINE) && defined(CONFIG_X86)
 
 static struct static_key_false nf_tables_skip_direct_calls;
 
@@ -207,7 +207,7 @@ static void expr_call_ops_eval(const struct nft_expr *expr,
                               struct nft_regs *regs,
                               struct nft_pktinfo *pkt)
 {
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
        unsigned long e;
 
        if (nf_skip_indirect_calls())
@@ -236,7 +236,7 @@ static void expr_call_ops_eval(const struct nft_expr *expr,
        X(e, nft_objref_map_eval);
 #undef  X
 indirect_call:
-#endif /* CONFIG_RETPOLINE */
+#endif /* CONFIG_MITIGATION_RETPOLINE */
        expr->ops->eval(expr, regs, pkt);
 }
 
index bfd3e5a14dab68484469bdba71af37a460822549..d73d49c7acd66caeec27c39bcf1b39355f4a3744 100644 (file)
@@ -754,7 +754,7 @@ static bool nft_ct_set_reduce(struct nft_regs_track *track,
        return false;
 }
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 static const struct nft_expr_ops nft_ct_get_fast_ops = {
        .type           = &nft_ct_type,
        .size           = NFT_EXPR_SIZE(sizeof(struct nft_ct)),
@@ -799,7 +799,7 @@ nft_ct_select_ops(const struct nft_ctx *ctx,
                return ERR_PTR(-EINVAL);
 
        if (tb[NFTA_CT_DREG]) {
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
                u32 k = ntohl(nla_get_be32(tb[NFTA_CT_KEY]));
 
                switch (k) {
index 870e5b113d13ec903b00a6f7921d7c162e57418f..a0055f510e31e9b77526a11c66c565b973897706 100644 (file)
@@ -24,7 +24,7 @@ struct nft_lookup {
        struct nft_set_binding          binding;
 };
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 bool nft_set_do_lookup(const struct net *net, const struct nft_set *set,
                       const u32 *key, const struct nft_set_ext **ext)
 {
index 36b025cc4fd263be35cdf6c6637c7d79e53c5f8f..87f6e3c6daa86dd870fe0ac5aefb50e76cd8bdd8 100644 (file)
@@ -2410,7 +2410,7 @@ static struct pernet_operations psched_net_ops = {
        .exit = psched_net_exit,
 };
 
-#if IS_ENABLED(CONFIG_RETPOLINE)
+#if IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)
 DEFINE_STATIC_KEY_FALSE(tc_skip_wrapper);
 #endif
 
index cd5b181060f151f2c28186feb5b96db37ee04da9..473f5496ae61e782865df6834cabeae5fd54e2d8 100644 (file)
@@ -254,7 +254,7 @@ objtool := $(objtree)/tools/objtool/objtool
 
 objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK)            += --hacks=jump_label
 objtool-args-$(CONFIG_HAVE_NOINSTR_HACK)               += --hacks=noinstr
-objtool-args-$(CONFIG_CALL_DEPTH_TRACKING)             += --hacks=skylake
+objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING)  += --hacks=skylake
 objtool-args-$(CONFIG_X86_KERNEL_IBT)                  += --ibt
 objtool-args-$(CONFIG_FINEIBT)                         += --cfi
 objtool-args-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL)       += --mcount
@@ -262,9 +262,9 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
 objtool-args-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT)         += --mnop
 endif
 objtool-args-$(CONFIG_UNWINDER_ORC)                    += --orc
-objtool-args-$(CONFIG_RETPOLINE)                       += --retpoline
-objtool-args-$(CONFIG_RETHUNK)                         += --rethunk
-objtool-args-$(CONFIG_SLS)                             += --sls
+objtool-args-$(CONFIG_MITIGATION_RETPOLINE)            += --retpoline
+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
 objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION)         += --uaccess
index 25b3b587d37c00cd77415ef8d6533e9a18c4dcc9..6de297916ce680accc8eff02aa2957cf8c915f19 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_MITIGATION_SRSO)), --unret)
 
 objtool-args = $(vmlinux-objtool-args-y) --link
 
index 0da52b548ba50f5e1333c3c2b2a18da2533a18a1..19f72bfdbb82a987f834024b3e36f48e95b58351 100644 (file)
@@ -155,7 +155,7 @@ fn main() {
             "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
         );
         let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
-        if cfg.has("RETPOLINE") {
+        if cfg.has("MITIGATION_RETPOLINE") {
             features += ",+retpoline-external-thunk";
         }
         ts.push("features", features);
index 267b9a0a3abcd849fe4f0bae4cddd8a287d26184..bf7c4b4b5ff45694322af0d6b221b6735ea1a739 100644 (file)
@@ -1848,7 +1848,7 @@ static void add_header(struct buffer *b, struct module *mod)
 
        buf_printf(b,
                   "\n"
-                  "#ifdef CONFIG_RETPOLINE\n"
+                  "#ifdef CONFIG_MITIGATION_RETPOLINE\n"
                   "MODULE_INFO(retpoline, \"Y\");\n"
                   "#endif\n");
 
index 702d93fdd10e8d44015cc687cb90106ae5bd422c..36d0c1e05e608afcee144516f087fd8ef264ad62 100644 (file)
 # define DISABLE_LA57  (1<<(X86_FEATURE_LA57 & 31))
 #endif
 
-#ifdef CONFIG_PAGE_TABLE_ISOLATION
+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
 # define DISABLE_PTI           0
 #else
 # define DISABLE_PTI           (1 << (X86_FEATURE_PTI & 31))
 #endif
 
-#ifdef CONFIG_RETPOLINE
+#ifdef CONFIG_MITIGATION_RETPOLINE
 # define DISABLE_RETPOLINE     0
 #else
 # define DISABLE_RETPOLINE     ((1 << (X86_FEATURE_RETPOLINE & 31)) | \
                                 (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))
 #endif
 
-#ifdef CONFIG_CPU_UNRET_ENTRY
+#ifdef CONFIG_MITIGATION_UNRET_ENTRY
 # define DISABLE_UNRET         0
 #else
 # define DISABLE_UNRET         (1 << (X86_FEATURE_UNRET & 31))
 #endif
 
-#ifdef CONFIG_CALL_DEPTH_TRACKING
+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING
 # define DISABLE_CALL_DEPTH_TRACKING   0
 #else
 # define DISABLE_CALL_DEPTH_TRACKING   (1 << (X86_FEATURE_CALL_DEPTH & 31))
index 29e949579ede616d62c0476d0ccab36339bf02d7..4134d27c696bdce8b5ce4b49a1cd94394ae22495 100644 (file)
@@ -83,7 +83,7 @@ bool arch_support_alt_relocation(struct special_alt *special_alt,
  *    TODO: Once we have DWARF CFI and smarter instruction decoding logic,
  *    ensure the same register is used in the mov and jump instructions.
  *
- *    NOTE: RETPOLINE made it harder still to decode dynamic jumps.
+ *    NOTE: MITIGATION_RETPOLINE made it harder still to decode dynamic jumps.
  */
 struct reloc *arch_find_switch_table(struct objtool_file *file,
                                    struct instruction *insn)
index 548ec3cd7c00ca532a286eca1e6ae46b20ae0101..8440b7bb343cc769d6cd45f64a5ab02f893afb11 100644 (file)
@@ -3980,11 +3980,11 @@ 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 {
-                       WARN_INSN(insn, "indirect %s found in RETPOLINE build",
+                       WARN_INSN(insn, "indirect %s found in MITIGATION_RETPOLINE build",
                                  insn->type == INSN_JUMP_DYNAMIC ? "jump" : "call");
                }