History

x86/bugs: Rename CONFIG_RETPOLINE => CONFIG_MITIGATION_RETPOLINE

Step 5/10 of the namespace unification of CPU mitigations related Kconfig options. [ mingo: Converted a few more uses in comments/messages as well. ]

Breno Leitao committed 2 years ago

Commit aefb2f21 parent ea4654e39 files · +62 −62Browse files

Unified · Split

39 files
  1. Documentation/admin-guide/hw-vuln/spectre.rst +4 −4
  2. Documentation/admin-guide/kernel-parameters.txt +2 −2
  3. arch/x86/Kconfig +3 −3
  4. arch/x86/Makefile +2 −2
  5. arch/x86/entry/vdso/Makefile +2 −2
  6. arch/x86/include/asm/disabled-features.h +1 −1
  7. arch/x86/include/asm/linkage.h +4 −4
  8. arch/x86/include/asm/nospec-branch.h +4 −4
  9. arch/x86/kernel/alternative.c +3 −3
  10. arch/x86/kernel/cpu/bugs.c +3 −3
  11. arch/x86/kernel/ftrace.c +1 −1
  12. arch/x86/kernel/kprobes/opt.c +1 −1
  13. arch/x86/kernel/vmlinux.lds.S +2 −2
  14. arch/x86/kvm/mmu/mmu.c +1 −1
  15. arch/x86/kvm/mmu/mmu_internal.h +1 −1
  16. arch/x86/kvm/svm/svm.c +1 −1
  17. arch/x86/kvm/svm/vmenter.S +2 −2
  18. arch/x86/kvm/vmx/vmx.c +1 −1
  19. arch/x86/lib/Makefile +1 −1
  20. arch/x86/net/bpf_jit_comp.c +1 −1
  21. arch/x86/net/bpf_jit_comp32.c +1 −1
  22. arch/x86/purgatory/Makefile +1 −1
  23. include/linux/compiler-gcc.h +1 −1
  24. include/linux/indirect_call_wrapper.h +1 −1
  25. include/linux/module.h +1 −1
  26. include/net/netfilter/nf_tables_core.h +1 −1
  27. include/net/tc_wrapper.h +1 −1
  28. kernel/trace/ring_buffer.c +1 −1
  29. net/netfilter/Makefile +1 −1
  30. net/netfilter/nf_tables_core.c +3 −3
  31. net/netfilter/nft_ct.c +2 −2
  32. net/netfilter/nft_lookup.c +1 −1
  33. net/sched/sch_api.c +1 −1
  34. scripts/Makefile.lib +1 −1
  35. scripts/generate_rust_target.rs +1 −1
  36. scripts/mod/modpost.c +1 −1
  37. tools/arch/x86/include/asm/disabled-features.h +1 −1
  38. tools/objtool/arch/x86/special.c +1 −1
  39. tools/objtool/check.c +1 −1
Documentation/admin-guide/hw-vuln/spectre.rst+4−4
@@ -473,8 +473,8 @@ Spectre variant 2 · 472 unmodified lines
473 -mindirect-branch=thunk-extern -mindirect-branch-register options.473 -mindirect-branch=thunk-extern -mindirect-branch-register options.
474 If the kernel is compiled with a Clang compiler, the compiler needs474 If the kernel is compiled with a Clang compiler, the compiler needs
475 to support -mretpoline-external-thunk option. The kernel config475 to support -mretpoline-external-thunk option. The kernel config
476 CONFIG_RETPOLINE needs to be turned on, and the CPU needs to run with476 CONFIG_MITIGATION_RETPOLINE needs to be turned on, and the CPU needs
477 the latest updated microcode.477 to run with the latest updated microcode.
478 478
479 On Intel Skylake-era systems the mitigation covers most, but not all,479 On Intel Skylake-era systems the mitigation covers most, but not all,
480 cases. See :ref:`[3] <spec_ref3>` for more details.480 cases. See :ref:`[3] <spec_ref3>` for more details.
@@ -609,8 +609,8 @@ kernel command line. · 128 unmodified lines
609 Selecting 'on' will, and 'auto' may, choose a609 Selecting 'on' will, and 'auto' may, choose a
610 mitigation method at run time according to the610 mitigation method at run time according to the
611 CPU, the available microcode, the setting of the611 CPU, the available microcode, the setting of the
612 CONFIG_RETPOLINE configuration option, and the612 CONFIG_MITIGATION_RETPOLINE configuration option,
613 compiler with which the kernel was built.613 and the compiler with which the kernel was built.
614 614
615 Selecting 'on' will also enable the mitigation615 Selecting 'on' will also enable the mitigation
616 against user space to user space task attacks.616 against user space to user space task attacks.
Documentation/admin-guide/kernel-parameters.txt+2−2
@@ -6007,8 +6007,8 @@ · 6006 unmodified lines
6007 Selecting 'on' will, and 'auto' may, choose a6007 Selecting 'on' will, and 'auto' may, choose a
6008 mitigation method at run time according to the6008 mitigation method at run time according to the
6009 CPU, the available microcode, the setting of the6009 CPU, the available microcode, the setting of the
6010 CONFIG_RETPOLINE configuration option, and the6010 CONFIG_MITIGATION_RETPOLINE configuration option,
6011 compiler with which the kernel was built.6011 and the compiler with which the kernel was built.
6012 6012
6013 Selecting 'on' will also enable the mitigation6013 Selecting 'on' will also enable the mitigation
6014 against user space to user space task attacks.6014 against user space to user space task attacks.
arch/x86/Kconfig+3−3
@@ -2457,7 +2457,7 @@ config CALL_PADDING · 2456 unmodified lines
2457 2457
2458config FINEIBT2458config FINEIBT
2459 def_bool y2459 def_bool y
2460 depends on X86_KERNEL_IBT && CFI_CLANG && RETPOLINE2460 depends on X86_KERNEL_IBT && CFI_CLANG && MITIGATION_RETPOLINE
2461 select CALL_PADDING2461 select CALL_PADDING
2462 2462
2463config HAVE_CALL_THUNKS2463config HAVE_CALL_THUNKS
@@ -2495,7 +2495,7 @@ config MITIGATION_PAGE_TABLE_ISOLATION · 31 unmodified lines
2495 2495
2496 See Documentation/arch/x86/pti.rst for more details.2496 See Documentation/arch/x86/pti.rst for more details.
2497 2497
2498config RETPOLINE2498config MITIGATION_RETPOLINE
2499 bool "Avoid speculative indirect branches in kernel"2499 bool "Avoid speculative indirect branches in kernel"
2500 select OBJTOOL if HAVE_OBJTOOL2500 select OBJTOOL if HAVE_OBJTOOL
2501 default y2501 default y
@@ -2507,7 +2507,7 @@ config RETPOLINE · 5 unmodified lines
2507 2507
2508config RETHUNK2508config RETHUNK
2509 bool "Enable return-thunks"2509 bool "Enable return-thunks"
2510 depends on RETPOLINE && CC_HAS_RETURN_THUNK2510 depends on MITIGATION_RETPOLINE && CC_HAS_RETURN_THUNK
2511 select OBJTOOL if HAVE_OBJTOOL2511 select OBJTOOL if HAVE_OBJTOOL
2512 default y if X86_642512 default y if X86_64
2513 help2513 help
arch/x86/Makefile+2−2
@@ -192,7 +192,7 @@ KBUILD_CFLAGS += -Wno-sign-compare · 191 unmodified lines
192KBUILD_CFLAGS += -fno-asynchronous-unwind-tables192KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
193 193
194# Avoid indirect branches in kernel to deal with Spectre194# Avoid indirect branches in kernel to deal with Spectre
195ifdef CONFIG_RETPOLINE195ifdef CONFIG_MITIGATION_RETPOLINE
196 KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)196 KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)
197 # Additionally, avoid generating expensive indirect jumps which197 # Additionally, avoid generating expensive indirect jumps which
198 # are subject to retpolines for small number of switch cases.198 # are subject to retpolines for small number of switch cases.
@@ -301,7 +301,7 @@ vdso-install-$(CONFIG_IA32_EMULATION) += arch/x86/entry/vdso/vdso32.so.dbg · 102 unmodified lines
301 301
302archprepare: checkbin302archprepare: checkbin
303checkbin:303checkbin:
304ifdef CONFIG_RETPOLINE304ifdef CONFIG_MITIGATION_RETPOLINE
305ifeq ($(RETPOLINE_CFLAGS),)305ifeq ($(RETPOLINE_CFLAGS),)
306 @echo "You are building kernel with non-retpoline compiler." >&2306 @echo "You are building kernel with non-retpoline compiler." >&2
307 @echo "Please update your compiler." >&2307 @echo "Please update your compiler." >&2
arch/x86/entry/vdso/Makefile+2−2
@@ -87,7 +87,7 @@ CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ · 86 unmodified lines
87 -fno-omit-frame-pointer -foptimize-sibling-calls \87 -fno-omit-frame-pointer -foptimize-sibling-calls \
88 -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO88 -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO
89 89
90ifdef CONFIG_RETPOLINE90ifdef CONFIG_MITIGATION_RETPOLINE
91ifneq ($(RETPOLINE_VDSO_CFLAGS),)91ifneq ($(RETPOLINE_VDSO_CFLAGS),)
92 CFL += $(RETPOLINE_VDSO_CFLAGS)92 CFL += $(RETPOLINE_VDSO_CFLAGS)
93endif93endif
@@ -164,7 +164,7 @@ KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) · 70 unmodified lines
164KBUILD_CFLAGS_32 += -fno-omit-frame-pointer164KBUILD_CFLAGS_32 += -fno-omit-frame-pointer
165KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING165KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
166 166
167ifdef CONFIG_RETPOLINE167ifdef CONFIG_MITIGATION_RETPOLINE
168ifneq ($(RETPOLINE_VDSO_CFLAGS),)168ifneq ($(RETPOLINE_VDSO_CFLAGS),)
169 KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS)169 KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS)
170endif170endif
arch/x86/include/asm/disabled-features.h+1−1
@@ -50,7 +50,7 @@ · 49 unmodified lines
50# define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))50# define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))
51#endif51#endif
52 52
53#ifdef CONFIG_RETPOLINE53#ifdef CONFIG_MITIGATION_RETPOLINE
54# define DISABLE_RETPOLINE 054# define DISABLE_RETPOLINE 0
55#else55#else
56# define DISABLE_RETPOLINE ((1 << (X86_FEATURE_RETPOLINE & 31)) | \56# define DISABLE_RETPOLINE ((1 << (X86_FEATURE_RETPOLINE & 31)) | \
arch/x86/include/asm/linkage.h+4−4
@@ -42,25 +42,25 @@ · 41 unmodified lines
42 42
43#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)43#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
44#define RET jmp __x86_return_thunk44#define RET jmp __x86_return_thunk
45#else /* CONFIG_RETPOLINE */45#else /* CONFIG_MITIGATION_RETPOLINE */
46#ifdef CONFIG_SLS46#ifdef CONFIG_SLS
47#define RET ret; int347#define RET ret; int3
48#else48#else
49#define RET ret49#define RET ret
50#endif50#endif
51#endif /* CONFIG_RETPOLINE */51#endif /* CONFIG_MITIGATION_RETPOLINE */
52 52
53#else /* __ASSEMBLY__ */53#else /* __ASSEMBLY__ */
54 54
55#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)55#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
56#define ASM_RET "jmp __x86_return_thunk\n\t"56#define ASM_RET "jmp __x86_return_thunk\n\t"
57#else /* CONFIG_RETPOLINE */57#else /* CONFIG_MITIGATION_RETPOLINE */
58#ifdef CONFIG_SLS58#ifdef CONFIG_SLS
59#define ASM_RET "ret; int3\n\t"59#define ASM_RET "ret; int3\n\t"
60#else60#else
61#define ASM_RET "ret\n\t"61#define ASM_RET "ret\n\t"
62#endif62#endif
63#endif /* CONFIG_RETPOLINE */63#endif /* CONFIG_MITIGATION_RETPOLINE */
64 64
65#endif /* __ASSEMBLY__ */65#endif /* __ASSEMBLY__ */
66 66
arch/x86/include/asm/nospec-branch.h+4−4
@@ -241,7 +241,7 @@ · 240 unmodified lines
241 * instruction irrespective of kCFI.241 * instruction irrespective of kCFI.
242 */242 */
243.macro JMP_NOSPEC reg:req243.macro JMP_NOSPEC reg:req
244#ifdef CONFIG_RETPOLINE244#ifdef CONFIG_MITIGATION_RETPOLINE
245 __CS_PREFIX \reg245 __CS_PREFIX \reg
246 jmp __x86_indirect_thunk_\reg246 jmp __x86_indirect_thunk_\reg
247#else247#else
@@ -251,7 +251,7 @@ · 3 unmodified lines
251.endm251.endm
252 252
253.macro CALL_NOSPEC reg:req253.macro CALL_NOSPEC reg:req
254#ifdef CONFIG_RETPOLINE254#ifdef CONFIG_MITIGATION_RETPOLINE
255 __CS_PREFIX \reg255 __CS_PREFIX \reg
256 call __x86_indirect_thunk_\reg256 call __x86_indirect_thunk_\reg
257#else257#else
@@ -378,7 +378,7 @@ static inline void call_depth_return_thunk(void) {} · 120 unmodified lines
378 378
379#endif /* CONFIG_MITIGATION_CALL_DEPTH_TRACKING */379#endif /* CONFIG_MITIGATION_CALL_DEPTH_TRACKING */
380 380
381#ifdef CONFIG_RETPOLINE381#ifdef CONFIG_MITIGATION_RETPOLINE
382 382
383#define GEN(reg) \383#define GEN(reg) \
384 extern retpoline_thunk_t __x86_indirect_thunk_ ## reg;384 extern retpoline_thunk_t __x86_indirect_thunk_ ## reg;
@@ -399,7 +399,7 @@ static inline void call_depth_return_thunk(void) {} · 14 unmodified lines
399 399
400/*400/*
401 * Inline asm uses the %V modifier which is only in newer GCC401 * Inline asm uses the %V modifier which is only in newer GCC
402 * which is ensured when CONFIG_RETPOLINE is defined.402 * which is ensured when CONFIG_MITIGATION_RETPOLINE is defined.
403 */403 */
404# define CALL_NOSPEC \404# define CALL_NOSPEC \
405 ALTERNATIVE_2( \405 ALTERNATIVE_2( \
arch/x86/kernel/alternative.c+3−3
@@ -544,7 +544,7 @@ static inline bool is_jcc32(struct insn *insn) · 543 unmodified lines
544 return insn->opcode.bytes[0] == 0x0f && (insn->opcode.bytes[1] & 0xf0) == 0x80;544 return insn->opcode.bytes[0] == 0x0f && (insn->opcode.bytes[1] & 0xf0) == 0x80;
545}545}
546 546
547#if defined(CONFIG_RETPOLINE) && defined(CONFIG_OBJTOOL)547#if defined(CONFIG_MITIGATION_RETPOLINE) && defined(CONFIG_OBJTOOL)
548 548
549/*549/*
550 * CALL/JMP *%\reg550 * CALL/JMP *%\reg
@@ -844,12 +844,12 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end) · 293 unmodified lines
844void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }844void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
845#endif /* CONFIG_RETHUNK */845#endif /* CONFIG_RETHUNK */
846 846
847#else /* !CONFIG_RETPOLINE || !CONFIG_OBJTOOL */847#else /* !CONFIG_MITIGATION_RETPOLINE || !CONFIG_OBJTOOL */
848 848
849void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) { }849void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) { }
850void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }850void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
851 851
852#endif /* CONFIG_RETPOLINE && CONFIG_OBJTOOL */852#endif /* CONFIG_MITIGATION_RETPOLINE && CONFIG_OBJTOOL */
853 853
854#ifdef CONFIG_X86_KERNEL_IBT854#ifdef CONFIG_X86_KERNEL_IBT
855 855
arch/x86/kernel/cpu/bugs.c+3−3
@@ -1103,7 +1103,7 @@ static enum spectre_v2_user_mitigation spectre_v2_user_stibp __ro_after_init = · 1102 unmodified lines
1103static enum spectre_v2_user_mitigation spectre_v2_user_ibpb __ro_after_init =1103static enum spectre_v2_user_mitigation spectre_v2_user_ibpb __ro_after_init =
1104 SPECTRE_V2_USER_NONE;1104 SPECTRE_V2_USER_NONE;
1105 1105
1106#ifdef CONFIG_RETPOLINE1106#ifdef CONFIG_MITIGATION_RETPOLINE
1107static bool spectre_v2_bad_module;1107static bool spectre_v2_bad_module;
1108 1108
1109bool retpoline_module_ok(bool has_retpoline)1109bool retpoline_module_ok(bool has_retpoline)
@@ -1416,7 +1416,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void) · 306 unmodified lines
1416 cmd == SPECTRE_V2_CMD_RETPOLINE_GENERIC ||1416 cmd == SPECTRE_V2_CMD_RETPOLINE_GENERIC ||
1417 cmd == SPECTRE_V2_CMD_EIBRS_LFENCE ||1417 cmd == SPECTRE_V2_CMD_EIBRS_LFENCE ||
1418 cmd == SPECTRE_V2_CMD_EIBRS_RETPOLINE) &&1418 cmd == SPECTRE_V2_CMD_EIBRS_RETPOLINE) &&
1419 !IS_ENABLED(CONFIG_RETPOLINE)) {1419 !IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {
1420 pr_err("%s selected but not compiled in. Switching to AUTO select\n",1420 pr_err("%s selected but not compiled in. Switching to AUTO select\n",
1421 mitigation_options[i].option);1421 mitigation_options[i].option);
1422 return SPECTRE_V2_CMD_AUTO;1422 return SPECTRE_V2_CMD_AUTO;
@@ -1470,7 +1470,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void) · 47 unmodified lines
1470 1470
1471static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)1471static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)
1472{1472{
1473 if (!IS_ENABLED(CONFIG_RETPOLINE)) {1473 if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {
1474 pr_err("Kernel not compiled with retpoline; no mitigation available!");1474 pr_err("Kernel not compiled with retpoline; no mitigation available!");
1475 return SPECTRE_V2_NONE;1475 return SPECTRE_V2_NONE;
1476 }1476 }
arch/x86/kernel/ftrace.c+1−1
@@ -307,7 +307,7 @@ union ftrace_op_code_union { · 306 unmodified lines
307 } __attribute__((packed));307 } __attribute__((packed));
308};308};
309 309
310#define RET_SIZE (IS_ENABLED(CONFIG_RETPOLINE) ? 5 : 1 + IS_ENABLED(CONFIG_SLS))310#define RET_SIZE (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) ? 5 : 1 + IS_ENABLED(CONFIG_SLS))
311 311
312static unsigned long312static unsigned long
313create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)313create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
arch/x86/kernel/kprobes/opt.c+1−1
@@ -324,7 +324,7 @@ static int can_optimize(unsigned long paddr) · 323 unmodified lines
324 * However, the kernel built with retpolines or IBT has jump324 * However, the kernel built with retpolines or IBT has jump
325 * tables disabled so the check can be skipped altogether.325 * tables disabled so the check can be skipped altogether.
326 */326 */
327 if (!IS_ENABLED(CONFIG_RETPOLINE) &&327 if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) &&
328 !IS_ENABLED(CONFIG_X86_KERNEL_IBT) &&328 !IS_ENABLED(CONFIG_X86_KERNEL_IBT) &&
329 insn_is_indirect_jump(&insn))329 insn_is_indirect_jump(&insn))
330 return 0;330 return 0;
arch/x86/kernel/vmlinux.lds.S+2−2
@@ -132,7 +132,7 @@ SECTIONS · 131 unmodified lines
132 LOCK_TEXT132 LOCK_TEXT
133 KPROBES_TEXT133 KPROBES_TEXT
134 SOFTIRQENTRY_TEXT134 SOFTIRQENTRY_TEXT
135#ifdef CONFIG_RETPOLINE135#ifdef CONFIG_MITIGATION_RETPOLINE
136 *(.text..__x86.indirect_thunk)136 *(.text..__x86.indirect_thunk)
137 *(.text..__x86.return_thunk)137 *(.text..__x86.return_thunk)
138#endif138#endif
@@ -267,7 +267,7 @@ SECTIONS · 128 unmodified lines
267 }267 }
268#endif268#endif
269 269
270#ifdef CONFIG_RETPOLINE270#ifdef CONFIG_MITIGATION_RETPOLINE
271 /*271 /*
272 * List of instructions that call/jmp/jcc to retpoline thunks272 * List of instructions that call/jmp/jcc to retpoline thunks
273 * __x86_indirect_thunk_*(). These instructions can be patched along273 * __x86_indirect_thunk_*(). These instructions can be patched along
arch/x86/kvm/mmu/mmu.c+1−1
@@ -263,7 +263,7 @@ static unsigned long get_guest_cr3(struct kvm_vcpu *vcpu) · 262 unmodified lines
263static inline unsigned long kvm_mmu_get_guest_pgd(struct kvm_vcpu *vcpu,263static inline unsigned long kvm_mmu_get_guest_pgd(struct kvm_vcpu *vcpu,
264 struct kvm_mmu *mmu)264 struct kvm_mmu *mmu)
265{265{
266 if (IS_ENABLED(CONFIG_RETPOLINE) && mmu->get_guest_pgd == get_guest_cr3)266 if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && mmu->get_guest_pgd == get_guest_cr3)
267 return kvm_read_cr3(vcpu);267 return kvm_read_cr3(vcpu);
268 268
269 return mmu->get_guest_pgd(vcpu);269 return mmu->get_guest_pgd(vcpu);
arch/x86/kvm/mmu/mmu_internal.h+1−1
@@ -312,7 +312,7 @@ static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, · 311 unmodified lines
312 if (!prefetch)312 if (!prefetch)
313 vcpu->stat.pf_taken++;313 vcpu->stat.pf_taken++;
314 314
315 if (IS_ENABLED(CONFIG_RETPOLINE) && fault.is_tdp)315 if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && fault.is_tdp)
316 r = kvm_tdp_page_fault(vcpu, &fault);316 r = kvm_tdp_page_fault(vcpu, &fault);
317 else317 else
318 r = vcpu->arch.mmu->page_fault(vcpu, &fault);318 r = vcpu->arch.mmu->page_fault(vcpu, &fault);
arch/x86/kvm/svm/svm.c+1−1
@@ -3455,7 +3455,7 @@ int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code) · 3454 unmodified lines
3455 if (!svm_check_exit_valid(exit_code))3455 if (!svm_check_exit_valid(exit_code))
3456 return svm_handle_invalid_exit(vcpu, exit_code);3456 return svm_handle_invalid_exit(vcpu, exit_code);
3457 3457
3458#ifdef CONFIG_RETPOLINE3458#ifdef CONFIG_MITIGATION_RETPOLINE
3459 if (exit_code == SVM_EXIT_MSR)3459 if (exit_code == SVM_EXIT_MSR)
3460 return msr_interception(vcpu);3460 return msr_interception(vcpu);
3461 else if (exit_code == SVM_EXIT_VINTR)3461 else if (exit_code == SVM_EXIT_VINTR)
arch/x86/kvm/svm/vmenter.S+2−2
@@ -207,7 +207,7 @@ SYM_FUNC_START(__svm_vcpu_run) · 206 unmodified lines
2077: vmload %_ASM_AX2077: vmload %_ASM_AX
2088:2088:
209 209
210#ifdef CONFIG_RETPOLINE210#ifdef CONFIG_MITIGATION_RETPOLINE
211 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */211 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
212 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE212 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
213#endif213#endif
@@ -344,7 +344,7 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run) · 130 unmodified lines
344 /* Pop @svm to RDI, guest registers have been saved already. */344 /* Pop @svm to RDI, guest registers have been saved already. */
345 pop %_ASM_DI345 pop %_ASM_DI
346 346
347#ifdef CONFIG_RETPOLINE347#ifdef CONFIG_MITIGATION_RETPOLINE
348 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */348 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
349 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE349 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
350#endif350#endif
arch/x86/kvm/vmx/vmx.c+1−1
@@ -6544,7 +6544,7 @@ static int __vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) · 6543 unmodified lines
6544 6544
6545 if (exit_reason.basic >= kvm_vmx_max_exit_handlers)6545 if (exit_reason.basic >= kvm_vmx_max_exit_handlers)
6546 goto unexpected_vmexit;6546 goto unexpected_vmexit;
6547#ifdef CONFIG_RETPOLINE6547#ifdef CONFIG_MITIGATION_RETPOLINE
6548 if (exit_reason.basic == EXIT_REASON_MSR_WRITE)6548 if (exit_reason.basic == EXIT_REASON_MSR_WRITE)
6549 return kvm_emulate_wrmsr(vcpu);6549 return kvm_emulate_wrmsr(vcpu);
6550 else if (exit_reason.basic == EXIT_REASON_PREEMPTION_TIMER)6550 else if (exit_reason.basic == EXIT_REASON_PREEMPTION_TIMER)
arch/x86/lib/Makefile+1−1
@@ -49,7 +49,7 @@ lib-$(CONFIG_ARCH_HAS_COPY_MC) += copy_mc.o copy_mc_64.o · 48 unmodified lines
49lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o insn-eval.o49lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o insn-eval.o
50lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o50lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
51lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o51lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
52lib-$(CONFIG_RETPOLINE) += retpoline.o52lib-$(CONFIG_MITIGATION_RETPOLINE) += retpoline.o
53 53
54obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o54obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o
55obj-y += iomem.o55obj-y += iomem.o
arch/x86/net/bpf_jit_comp.c+1−1
@@ -469,7 +469,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip) · 468 unmodified lines
469 emit_jump(&prog, &__x86_indirect_thunk_array[reg], ip);469 emit_jump(&prog, &__x86_indirect_thunk_array[reg], ip);
470 } else {470 } else {
471 EMIT2(0xFF, 0xE0 + reg); /* jmp *%\reg */471 EMIT2(0xFF, 0xE0 + reg); /* jmp *%\reg */
472 if (IS_ENABLED(CONFIG_RETPOLINE) || IS_ENABLED(CONFIG_SLS))472 if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) || IS_ENABLED(CONFIG_SLS))
473 EMIT1(0xCC); /* int3 */473 EMIT1(0xCC); /* int3 */
474 }474 }
475 475
arch/x86/net/bpf_jit_comp32.c+1−1
@@ -1273,7 +1273,7 @@ static int emit_jmp_edx(u8 **pprog, u8 *ip) · 1272 unmodified lines
1273 u8 *prog = *pprog;1273 u8 *prog = *pprog;
1274 int cnt = 0;1274 int cnt = 0;
1275 1275
1276#ifdef CONFIG_RETPOLINE1276#ifdef CONFIG_MITIGATION_RETPOLINE
1277 EMIT1_off32(0xE9, (u8 *)__x86_indirect_thunk_edx - (ip + 5));1277 EMIT1_off32(0xE9, (u8 *)__x86_indirect_thunk_edx - (ip + 5));
1278#else1278#else
1279 EMIT2(0xFF, 0xE2);1279 EMIT2(0xFF, 0xE2);
arch/x86/purgatory/Makefile+1−1
@@ -61,7 +61,7 @@ ifdef CONFIG_STACKPROTECTOR_STRONG · 60 unmodified lines
61PURGATORY_CFLAGS_REMOVE += -fstack-protector-strong61PURGATORY_CFLAGS_REMOVE += -fstack-protector-strong
62endif62endif
63 63
64ifdef CONFIG_RETPOLINE64ifdef CONFIG_MITIGATION_RETPOLINE
65PURGATORY_CFLAGS_REMOVE += $(RETPOLINE_CFLAGS)65PURGATORY_CFLAGS_REMOVE += $(RETPOLINE_CFLAGS)
66endif66endif
67 67
include/linux/compiler-gcc.h+1−1
@@ -35,7 +35,7 @@ · 34 unmodified lines
35 (typeof(ptr)) (__ptr + (off)); \35 (typeof(ptr)) (__ptr + (off)); \
36})36})
37 37
38#ifdef CONFIG_RETPOLINE38#ifdef CONFIG_MITIGATION_RETPOLINE
39#define __noretpoline __attribute__((__indirect_branch__("keep")))39#define __noretpoline __attribute__((__indirect_branch__("keep")))
40#endif40#endif
41 41
include/linux/indirect_call_wrapper.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2#ifndef _LINUX_INDIRECT_CALL_WRAPPER_H2#ifndef _LINUX_INDIRECT_CALL_WRAPPER_H
3#define _LINUX_INDIRECT_CALL_WRAPPER_H3#define _LINUX_INDIRECT_CALL_WRAPPER_H
4 4
5#ifdef CONFIG_RETPOLINE5#ifdef CONFIG_MITIGATION_RETPOLINE
6 6
7/*7/*
8 * INDIRECT_CALL_$NR - wrapper for indirect calls with $NR known builtin8 * INDIRECT_CALL_$NR - wrapper for indirect calls with $NR known builtin
include/linux/module.h+1−1
@@ -885,7 +885,7 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr, · 884 unmodified lines
885static inline void module_bug_cleanup(struct module *mod) {}885static inline void module_bug_cleanup(struct module *mod) {}
886#endif /* CONFIG_GENERIC_BUG */886#endif /* CONFIG_GENERIC_BUG */
887 887
888#ifdef CONFIG_RETPOLINE888#ifdef CONFIG_MITIGATION_RETPOLINE
889extern bool retpoline_module_ok(bool has_retpoline);889extern bool retpoline_module_ok(bool has_retpoline);
890#else890#else
891static inline bool retpoline_module_ok(bool has_retpoline)891static inline bool retpoline_module_ok(bool has_retpoline)
include/net/netfilter/nf_tables_core.h+1−1
@@ -93,7 +93,7 @@ extern const struct nft_set_type nft_set_bitmap_type; · 92 unmodified lines
93extern const struct nft_set_type nft_set_pipapo_type;93extern const struct nft_set_type nft_set_pipapo_type;
94extern const struct nft_set_type nft_set_pipapo_avx2_type;94extern const struct nft_set_type nft_set_pipapo_avx2_type;
95 95
96#ifdef CONFIG_RETPOLINE96#ifdef CONFIG_MITIGATION_RETPOLINE
97bool nft_rhash_lookup(const struct net *net, const struct nft_set *set,97bool nft_rhash_lookup(const struct net *net, const struct nft_set *set,
98 const u32 *key, const struct nft_set_ext **ext);98 const u32 *key, const struct nft_set_ext **ext);
99bool nft_rbtree_lookup(const struct net *net, const struct nft_set *set,99bool nft_rbtree_lookup(const struct net *net, const struct nft_set *set,
include/net/tc_wrapper.h+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
4 4
5#include <net/pkt_cls.h>5#include <net/pkt_cls.h>
6 6
7#if IS_ENABLED(CONFIG_RETPOLINE)7#if IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)
8 8
9#include <linux/cpufeature.h>9#include <linux/cpufeature.h>
10#include <linux/static_key.h>10#include <linux/static_key.h>
kernel/trace/ring_buffer.c+1−1
@@ -1156,7 +1156,7 @@ static inline u64 rb_time_stamp(struct trace_buffer *buffer) · 1155 unmodified lines
1156 u64 ts;1156 u64 ts;
1157 1157
1158 /* Skip retpolines :-( */1158 /* Skip retpolines :-( */
1159 if (IS_ENABLED(CONFIG_RETPOLINE) && likely(buffer->clock == trace_clock_local))1159 if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && likely(buffer->clock == trace_clock_local))
1160 ts = trace_clock_local();1160 ts = trace_clock_local();
1161 else1161 else
1162 ts = buffer->clock();1162 ts = buffer->clock();
net/netfilter/Makefile+1−1
@@ -101,7 +101,7 @@ endif · 100 unmodified lines
101endif101endif
102 102
103ifdef CONFIG_NFT_CT103ifdef CONFIG_NFT_CT
104ifdef CONFIG_RETPOLINE104ifdef CONFIG_MITIGATION_RETPOLINE
105nf_tables-objs += nft_ct_fast.o105nf_tables-objs += nft_ct_fast.o
106endif106endif
107endif107endif
net/netfilter/nf_tables_core.c+3−3
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#include <net/netfilter/nf_log.h>21#include <net/netfilter/nf_log.h>
22#include <net/netfilter/nft_meta.h>22#include <net/netfilter/nft_meta.h>
23 23
24#if defined(CONFIG_RETPOLINE) && defined(CONFIG_X86)24#if defined(CONFIG_MITIGATION_RETPOLINE) && defined(CONFIG_X86)
25 25
26static struct static_key_false nf_tables_skip_direct_calls;26static struct static_key_false nf_tables_skip_direct_calls;
27 27
@@ -207,7 +207,7 @@ static void expr_call_ops_eval(const struct nft_expr *expr, · 179 unmodified lines
207 struct nft_regs *regs,207 struct nft_regs *regs,
208 struct nft_pktinfo *pkt)208 struct nft_pktinfo *pkt)
209{209{
210#ifdef CONFIG_RETPOLINE210#ifdef CONFIG_MITIGATION_RETPOLINE
211 unsigned long e;211 unsigned long e;
212 212
213 if (nf_skip_indirect_calls())213 if (nf_skip_indirect_calls())
@@ -236,7 +236,7 @@ static void expr_call_ops_eval(const struct nft_expr *expr, · 22 unmodified lines
236 X(e, nft_objref_map_eval);236 X(e, nft_objref_map_eval);
237#undef X237#undef X
238indirect_call:238indirect_call:
239#endif /* CONFIG_RETPOLINE */239#endif /* CONFIG_MITIGATION_RETPOLINE */
240 expr->ops->eval(expr, regs, pkt);240 expr->ops->eval(expr, regs, pkt);
241}241}
242 242
net/netfilter/nft_ct.c+2−2
@@ -751,7 +751,7 @@ static bool nft_ct_set_reduce(struct nft_regs_track *track, · 750 unmodified lines
751 return false;751 return false;
752}752}
753 753
754#ifdef CONFIG_RETPOLINE754#ifdef CONFIG_MITIGATION_RETPOLINE
755static const struct nft_expr_ops nft_ct_get_fast_ops = {755static const struct nft_expr_ops nft_ct_get_fast_ops = {
756 .type = &nft_ct_type,756 .type = &nft_ct_type,
757 .size = NFT_EXPR_SIZE(sizeof(struct nft_ct)),757 .size = NFT_EXPR_SIZE(sizeof(struct nft_ct)),
@@ -796,7 +796,7 @@ nft_ct_select_ops(const struct nft_ctx *ctx, · 38 unmodified lines
796 return ERR_PTR(-EINVAL);796 return ERR_PTR(-EINVAL);
797 797
798 if (tb[NFTA_CT_DREG]) {798 if (tb[NFTA_CT_DREG]) {
799#ifdef CONFIG_RETPOLINE799#ifdef CONFIG_MITIGATION_RETPOLINE
800 u32 k = ntohl(nla_get_be32(tb[NFTA_CT_KEY]));800 u32 k = ntohl(nla_get_be32(tb[NFTA_CT_KEY]));
801 801
802 switch (k) {802 switch (k) {
net/netfilter/nft_lookup.c+1−1
@@ -24,7 +24,7 @@ struct nft_lookup { · 23 unmodified lines
24 struct nft_set_binding binding;24 struct nft_set_binding binding;
25};25};
26 26
27#ifdef CONFIG_RETPOLINE27#ifdef CONFIG_MITIGATION_RETPOLINE
28bool nft_set_do_lookup(const struct net *net, const struct nft_set *set,28bool nft_set_do_lookup(const struct net *net, const struct nft_set *set,
29 const u32 *key, const struct nft_set_ext **ext)29 const u32 *key, const struct nft_set_ext **ext)
30{30{
net/sched/sch_api.c+1−1
@@ -2353,7 +2353,7 @@ static struct pernet_operations psched_net_ops = { · 2352 unmodified lines
2353 .exit = psched_net_exit,2353 .exit = psched_net_exit,
2354};2354};
2355 2355
2356#if IS_ENABLED(CONFIG_RETPOLINE)2356#if IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)
2357DEFINE_STATIC_KEY_FALSE(tc_skip_wrapper);2357DEFINE_STATIC_KEY_FALSE(tc_skip_wrapper);
2358#endif2358#endif
2359 2359
scripts/Makefile.lib+1−1
@@ -262,7 +262,7 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL · 261 unmodified lines
262objtool-args-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT) += --mnop262objtool-args-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT) += --mnop
263endif263endif
264objtool-args-$(CONFIG_UNWINDER_ORC) += --orc264objtool-args-$(CONFIG_UNWINDER_ORC) += --orc
265objtool-args-$(CONFIG_RETPOLINE) += --retpoline265objtool-args-$(CONFIG_MITIGATION_RETPOLINE) += --retpoline
266objtool-args-$(CONFIG_RETHUNK) += --rethunk266objtool-args-$(CONFIG_RETHUNK) += --rethunk
267objtool-args-$(CONFIG_SLS) += --sls267objtool-args-$(CONFIG_SLS) += --sls
268objtool-args-$(CONFIG_STACK_VALIDATION) += --stackval268objtool-args-$(CONFIG_STACK_VALIDATION) += --stackval
scripts/generate_rust_target.rs+1−1
@@ -155,7 +155,7 @@ fn main() { · 154 unmodified lines
155 "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",155 "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
156 );156 );
157 let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();157 let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
158 if cfg.has("RETPOLINE") {158 if cfg.has("MITIGATION_RETPOLINE") {
159 features += ",+retpoline-external-thunk";159 features += ",+retpoline-external-thunk";
160 }160 }
161 ts.push("features", features);161 ts.push("features", features);
scripts/mod/modpost.c+1−1
@@ -1843,7 +1843,7 @@ static void add_header(struct buffer *b, struct module *mod) · 1842 unmodified lines
1843 1843
1844 buf_printf(b,1844 buf_printf(b,
1845 "\n"1845 "\n"
1846 "#ifdef CONFIG_RETPOLINE\n"1846 "#ifdef CONFIG_MITIGATION_RETPOLINE\n"
1847 "MODULE_INFO(retpoline, \"Y\");\n"1847 "MODULE_INFO(retpoline, \"Y\");\n"
1848 "#endif\n");1848 "#endif\n");
1849 1849
tools/arch/x86/include/asm/disabled-features.h+1−1
@@ -50,7 +50,7 @@ · 49 unmodified lines
50# define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))50# define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))
51#endif51#endif
52 52
53#ifdef CONFIG_RETPOLINE53#ifdef CONFIG_MITIGATION_RETPOLINE
54# define DISABLE_RETPOLINE 054# define DISABLE_RETPOLINE 0
55#else55#else
56# define DISABLE_RETPOLINE ((1 << (X86_FEATURE_RETPOLINE & 31)) | \56# define DISABLE_RETPOLINE ((1 << (X86_FEATURE_RETPOLINE & 31)) | \
tools/objtool/arch/x86/special.c+1−1
@@ -83,7 +83,7 @@ bool arch_support_alt_relocation(struct special_alt *special_alt, · 82 unmodified lines
83 * TODO: Once we have DWARF CFI and smarter instruction decoding logic,83 * TODO: Once we have DWARF CFI and smarter instruction decoding logic,
84 * ensure the same register is used in the mov and jump instructions.84 * ensure the same register is used in the mov and jump instructions.
85 *85 *
86 * NOTE: RETPOLINE made it harder still to decode dynamic jumps.86 * NOTE: MITIGATION_RETPOLINE made it harder still to decode dynamic jumps.
87 */87 */
88struct reloc *arch_find_switch_table(struct objtool_file *file,88struct reloc *arch_find_switch_table(struct objtool_file *file,
89 struct instruction *insn)89 struct instruction *insn)
tools/objtool/check.c+1−1
@@ -3984,7 +3984,7 @@ static int validate_retpoline(struct objtool_file *file) · 3983 unmodified lines
3984 } else3984 } else
3985 continue;3985 continue;
3986 } else {3986 } else {
3987 WARN_INSN(insn, "indirect %s found in RETPOLINE build",3987 WARN_INSN(insn, "indirect %s found in MITIGATION_RETPOLINE build",
3988 insn->type == INSN_JUMP_DYNAMIC ? "jump" : "call");3988 insn->type == INSN_JUMP_DYNAMIC ? "jump" : "call");
3989 }3989 }
3990 3990

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t