···473473 -mindirect-branch=thunk-extern -mindirect-branch-register options.474474 If the kernel is compiled with a Clang compiler, the compiler needs475475 to support -mretpoline-external-thunk option. The kernel config476476- CONFIG_RETPOLINE needs to be turned on, and the CPU needs to run with477477- the latest updated microcode.476476+ CONFIG_MITIGATION_RETPOLINE needs to be turned on, and the CPU needs477477+ to run with the latest updated microcode.478478479479 On Intel Skylake-era systems the mitigation covers most, but not all,480480 cases. See :ref:`[3] <spec_ref3>` for more details.···609609 Selecting 'on' will, and 'auto' may, choose a610610 mitigation method at run time according to the611611 CPU, the available microcode, the setting of the612612- CONFIG_RETPOLINE configuration option, and the613613- compiler with which the kernel was built.612612+ CONFIG_MITIGATION_RETPOLINE configuration option,613613+ and the compiler with which the kernel was built.614614615615 Selecting 'on' will also enable the mitigation616616 against user space to user space task attacks.
+2-2
Documentation/admin-guide/kernel-parameters.txt
···60276027 Selecting 'on' will, and 'auto' may, choose a60286028 mitigation method at run time according to the60296029 CPU, the available microcode, the setting of the60306030- CONFIG_RETPOLINE configuration option, and the60316031- compiler with which the kernel was built.60306030+ CONFIG_MITIGATION_RETPOLINE configuration option,60316031+ and the compiler with which the kernel was built.6032603260336033 Selecting 'on' will also enable the mitigation60346034 against user space to user space task attacks.
+3-3
Documentation/arch/x86/pti.rst
···26262727This approach helps to ensure that side-channel attacks leveraging2828the paging structures do not function when PTI is enabled. It can be2929-enabled by setting CONFIG_PAGE_TABLE_ISOLATION=y at compile time.3030-Once enabled at compile-time, it can be disabled at boot with the3131-'nopti' or 'pti=' kernel parameters (see kernel-parameters.txt).2929+enabled by setting CONFIG_MITIGATION_PAGE_TABLE_ISOLATION=y at compile3030+time. Once enabled at compile-time, it can be disabled at boot with3131+the 'nopti' or 'pti=' kernel parameters (see kernel-parameters.txt).32323333Page Table Management3434=====================
+16-16
arch/x86/Kconfig
···2477247724782478config FINEIBT24792479 def_bool y24802480- depends on X86_KERNEL_IBT && CFI_CLANG && RETPOLINE24802480+ depends on X86_KERNEL_IBT && CFI_CLANG && MITIGATION_RETPOLINE24812481 select CALL_PADDING2482248224832483config HAVE_CALL_THUNKS24842484 def_bool y24852485- depends on CC_HAS_ENTRY_PADDING && RETHUNK && OBJTOOL24852485+ depends on CC_HAS_ENTRY_PADDING && MITIGATION_RETHUNK && OBJTOOL2486248624872487config CALL_THUNKS24882488 def_bool n···2504250425052505if SPECULATION_MITIGATIONS2506250625072507-config PAGE_TABLE_ISOLATION25072507+config MITIGATION_PAGE_TABLE_ISOLATION25082508 bool "Remove the kernel mapping in user mode"25092509 default y25102510 depends on (X86_64 || X86_PAE)···2515251525162516 See Documentation/arch/x86/pti.rst for more details.2517251725182518-config RETPOLINE25182518+config MITIGATION_RETPOLINE25192519 bool "Avoid speculative indirect branches in kernel"25202520 select OBJTOOL if HAVE_OBJTOOL25212521 default y···25252525 branches. Requires a compiler with -mindirect-branch=thunk-extern25262526 support for full protection. The kernel may run slower.2527252725282528-config RETHUNK25282528+config MITIGATION_RETHUNK25292529 bool "Enable return-thunks"25302530- depends on RETPOLINE && CC_HAS_RETURN_THUNK25302530+ depends on MITIGATION_RETPOLINE && CC_HAS_RETURN_THUNK25312531 select OBJTOOL if HAVE_OBJTOOL25322532 default y if X86_6425332533 help···25362536 Requires a compiler with -mfunction-return=thunk-extern25372537 support for full protection. The kernel may run slower.2538253825392539-config CPU_UNRET_ENTRY25392539+config MITIGATION_UNRET_ENTRY25402540 bool "Enable UNRET on kernel entry"25412541- depends on CPU_SUP_AMD && RETHUNK && X86_6425412541+ depends on CPU_SUP_AMD && MITIGATION_RETHUNK && X86_6425422542 default y25432543 help25442544 Compile the kernel with support for the retbleed=unret mitigation.2545254525462546-config CALL_DEPTH_TRACKING25462546+config MITIGATION_CALL_DEPTH_TRACKING25472547 bool "Mitigate RSB underflow with call depth tracking"25482548 depends on CPU_SUP_INTEL && HAVE_CALL_THUNKS25492549 select HAVE_DYNAMIC_FTRACE_NO_PATCHABLE···2563256325642564config CALL_THUNKS_DEBUG25652565 bool "Enable call thunks and call depth tracking debugging"25662566- depends on CALL_DEPTH_TRACKING25662566+ depends on MITIGATION_CALL_DEPTH_TRACKING25672567 select FUNCTION_ALIGNMENT_32B25682568 default n25692569 help···25742574 Only enable this when you are debugging call thunks as this25752575 creates a noticeable runtime overhead. If unsure say N.2576257625772577-config CPU_IBPB_ENTRY25772577+config MITIGATION_IBPB_ENTRY25782578 bool "Enable IBPB on kernel entry"25792579 depends on CPU_SUP_AMD && X86_6425802580 default y25812581 help25822582 Compile the kernel with support for the retbleed=ibpb mitigation.2583258325842584-config CPU_IBRS_ENTRY25842584+config MITIGATION_IBRS_ENTRY25852585 bool "Enable IBRS on kernel entry"25862586 depends on CPU_SUP_INTEL && X86_6425872587 default y···25902590 This mitigates both spectre_v2 and retbleed at great cost to25912591 performance.2592259225932593-config CPU_SRSO25932593+config MITIGATION_SRSO25942594 bool "Mitigate speculative RAS overflow on AMD"25952595- depends on CPU_SUP_AMD && X86_64 && RETHUNK25952595+ depends on CPU_SUP_AMD && X86_64 && MITIGATION_RETHUNK25962596 default y25972597 help25982598 Enable the SRSO mitigation needed on AMD Zen1-4 machines.2599259926002600-config SLS26002600+config MITIGATION_SLS26012601 bool "Mitigate Straight-Line-Speculation"26022602 depends on CC_HAS_SLS && X86_6426032603 select OBJTOOL if HAVE_OBJTOOL···26072607 against straight line speculation. The kernel image might be slightly26082608 larger.2609260926102610-config GDS_FORCE_MITIGATION26102610+config MITIGATION_GDS_FORCE26112611 bool "Force GDS Mitigation"26122612 depends on CPU_SUP_INTEL26132613 default n
+4-4
arch/x86/Makefile
···2222endif2323RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch-cs-prefix)24242525-ifdef CONFIG_RETHUNK2525+ifdef CONFIG_MITIGATION_RETHUNK2626RETHUNK_CFLAGS := -mfunction-return=thunk-extern2727RETPOLINE_CFLAGS += $(RETHUNK_CFLAGS)2828endif···192192KBUILD_CFLAGS += -fno-asynchronous-unwind-tables193193194194# Avoid indirect branches in kernel to deal with Spectre195195-ifdef CONFIG_RETPOLINE195195+ifdef CONFIG_MITIGATION_RETPOLINE196196 KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)197197 # Additionally, avoid generating expensive indirect jumps which198198 # are subject to retpolines for small number of switch cases.···205205 endif206206endif207207208208-ifdef CONFIG_SLS208208+ifdef CONFIG_MITIGATION_SLS209209 KBUILD_CFLAGS += -mharden-sls=all210210endif211211···301301302302archprepare: checkbin303303checkbin:304304-ifdef CONFIG_RETPOLINE304304+ifdef CONFIG_MITIGATION_RETPOLINE305305ifeq ($(RETPOLINE_CFLAGS),)306306 @echo "You are building kernel with non-retpoline compiler." >&2307307 @echo "Please update your compiler." >&2
+2-2
arch/x86/boot/compressed/ident_map_64.c
···88 * Copyright (C) 2016 Kees Cook99 */10101111-/* No PAGE_TABLE_ISOLATION support needed either: */1212-#undef CONFIG_PAGE_TABLE_ISOLATION1111+/* No MITIGATION_PAGE_TABLE_ISOLATION support needed either: */1212+#undef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION13131414#include "error.h"1515#include "misc.h"
+1-1
arch/x86/configs/i386_defconfig
···4242CONFIG_HZ_1000=y4343CONFIG_KEXEC=y4444CONFIG_CRASH_DUMP=y4545-# CONFIG_RETHUNK is not set4545+# CONFIG_MITIGATION_RETHUNK is not set4646CONFIG_HIBERNATION=y4747CONFIG_PM_DEBUG=y4848CONFIG_PM_TRACE_RTC=y
+66-6
arch/x86/entry/calling.h
···142142 .endif143143.endm144144145145-#ifdef CONFIG_PAGE_TABLE_ISOLATION145145+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION146146147147/*148148- * PAGE_TABLE_ISOLATION PGDs are 8k. Flip bit 12 to switch between the two148148+ * MITIGATION_PAGE_TABLE_ISOLATION PGDs are 8k. Flip bit 12 to switch between the two149149 * halves:150150 */151151#define PTI_USER_PGTABLE_BIT PAGE_SHIFT···160160161161.macro ADJUST_KERNEL_CR3 reg:req162162 ALTERNATIVE "", "SET_NOFLUSH_BIT \reg", X86_FEATURE_PCID163163- /* Clear PCID and "PAGE_TABLE_ISOLATION bit", point CR3 at kernel pagetables: */163163+ /* Clear PCID and "MITIGATION_PAGE_TABLE_ISOLATION bit", point CR3 at kernel pagetables: */164164 andq $(~PTI_USER_PGTABLE_AND_PCID_MASK), \reg165165.endm166166···275275.Lend_\@:276276.endm277277278278-#else /* CONFIG_PAGE_TABLE_ISOLATION=n: */278278+#else /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION=n: */279279280280.macro SWITCH_TO_KERNEL_CR3 scratch_reg:req281281.endm···303303 * Assumes x86_spec_ctrl_{base,current} to have SPEC_CTRL_IBRS set.304304 */305305.macro IBRS_ENTER save_reg306306-#ifdef CONFIG_CPU_IBRS_ENTRY306306+#ifdef CONFIG_MITIGATION_IBRS_ENTRY307307 ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_KERNEL_IBRS308308 movl $MSR_IA32_SPEC_CTRL, %ecx309309···332332 * regs. Must be called after the last RET.333333 */334334.macro IBRS_EXIT save_reg335335-#ifdef CONFIG_CPU_IBRS_ENTRY335335+#ifdef CONFIG_MITIGATION_IBRS_ENTRY336336 ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_KERNEL_IBRS337337 movl $MSR_IA32_SPEC_CTRL, %ecx338338···426426.endm427427428428#endif /* CONFIG_SMP */429429+430430+#ifdef CONFIG_X86_64431431+432432+/* rdi: arg1 ... normal C conventions. rax is saved/restored. */433433+.macro THUNK name, func434434+SYM_FUNC_START(\name)435435+ pushq %rbp436436+ movq %rsp, %rbp437437+438438+ pushq %rdi439439+ pushq %rsi440440+ pushq %rdx441441+ pushq %rcx442442+ pushq %rax443443+ pushq %r8444444+ pushq %r9445445+ pushq %r10446446+ pushq %r11447447+448448+ call \func449449+450450+ popq %r11451451+ popq %r10452452+ popq %r9453453+ popq %r8454454+ popq %rax455455+ popq %rcx456456+ popq %rdx457457+ popq %rsi458458+ popq %rdi459459+ popq %rbp460460+ RET461461+SYM_FUNC_END(\name)462462+ _ASM_NOKPROBE(\name)463463+.endm464464+465465+#else /* CONFIG_X86_32 */466466+467467+/* put return address in eax (arg1) */468468+.macro THUNK name, func, put_ret_addr_in_eax=0469469+SYM_CODE_START_NOALIGN(\name)470470+ pushl %eax471471+ pushl %ecx472472+ pushl %edx473473+474474+ .if \put_ret_addr_in_eax475475+ /* Place EIP in the arg1 */476476+ movl 3*4(%esp), %eax477477+ .endif478478+479479+ call \func480480+ popl %edx481481+ popl %ecx482482+ popl %eax483483+ RET484484+ _ASM_NOKPROBE(\name)485485+SYM_CODE_END(\name)486486+ .endm487487+488488+#endif
···562562#ifdef CONFIG_XEN_PV563563 ALTERNATIVE "", "jmp xenpv_restore_regs_and_return_to_usermode", X86_FEATURE_XENPV564564#endif565565-#ifdef CONFIG_PAGE_TABLE_ISOLATION565565+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION566566 ALTERNATIVE "", "jmp .Lpti_restore_regs_and_return_to_usermode", X86_FEATURE_PTI567567#endif568568···578578 jnz .Lnative_iret579579 ud2580580581581-#ifdef CONFIG_PAGE_TABLE_ISOLATION581581+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION582582.Lpti_restore_regs_and_return_to_usermode:583583 POP_REGS pop_rdi=0584584···10961096 *10971097 * Registers:10981098 * %r14: Used to save/restore the CR3 of the interrupted context10991099- * when PAGE_TABLE_ISOLATION is in use. Do not clobber.10991099+ * when MITIGATION_PAGE_TABLE_ISOLATION is in use. Do not clobber.11001100 */11011101SYM_CODE_START(asm_exc_nmi)11021102 UNWIND_HINT_IRET_ENTRY
+8-26
arch/x86/entry/thunk_32.S
···44 * Copyright 2008 by Steven Rostedt, Red Hat, Inc55 * (inspired by Andi Kleen's thunk_64.S)66 */77- #include <linux/export.h>88- #include <linux/linkage.h>99- #include <asm/asm.h>1071111- /* put return address in eax (arg1) */1212- .macro THUNK name, func, put_ret_addr_in_eax=01313-SYM_CODE_START_NOALIGN(\name)1414- pushl %eax1515- pushl %ecx1616- pushl %edx88+#include <linux/export.h>99+#include <linux/linkage.h>1010+#include <asm/asm.h>17111818- .if \put_ret_addr_in_eax1919- /* Place EIP in the arg1 */2020- movl 3*4(%esp), %eax2121- .endif1212+#include "calling.h"22132323- call \func2424- popl %edx2525- popl %ecx2626- popl %eax2727- RET2828- _ASM_NOKPROBE(\name)2929-SYM_CODE_END(\name)3030- .endm3131-3232- THUNK preempt_schedule_thunk, preempt_schedule3333- THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace3434- EXPORT_SYMBOL(preempt_schedule_thunk)3535- EXPORT_SYMBOL(preempt_schedule_notrace_thunk)1414+THUNK preempt_schedule_thunk, preempt_schedule1515+THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace1616+EXPORT_SYMBOL(preempt_schedule_thunk)1717+EXPORT_SYMBOL(preempt_schedule_notrace_thunk)3618
···1818 struct task_struct *current_task;1919 int preempt_count;2020 int cpu_number;2121-#ifdef CONFIG_CALL_DEPTH_TRACKING2121+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING2222 u64 call_depth;2323#endif2424 unsigned long top_of_stack;
···7373# define CALL_THUNKS_DEBUG_INC_CTXSW7474#endif75757676-#if defined(CONFIG_CALL_DEPTH_TRACKING) && !defined(COMPILE_OFFSETS)7676+#if defined(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) && !defined(COMPILE_OFFSETS)77777878#include <asm/asm-offsets.h>7979···203203 */204204.macro VALIDATE_UNRET_END205205#if defined(CONFIG_NOINSTR_VALIDATION) && \206206- (defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO))206206+ (defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO))207207 ANNOTATE_RETPOLINE_SAFE208208 nop209209#endif···232232 * instruction irrespective of kCFI.233233 */234234.macro JMP_NOSPEC reg:req235235-#ifdef CONFIG_RETPOLINE235235+#ifdef CONFIG_MITIGATION_RETPOLINE236236 __CS_PREFIX \reg237237 jmp __x86_indirect_thunk_\reg238238#else···242242.endm243243244244.macro CALL_NOSPEC reg:req245245-#ifdef CONFIG_RETPOLINE245245+#ifdef CONFIG_MITIGATION_RETPOLINE246246 __CS_PREFIX \reg247247 call __x86_indirect_thunk_\reg248248#else···262262.Lskip_rsb_\@:263263.endm264264265265-#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)265265+#if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO)266266#define CALL_UNTRAIN_RET "call entry_untrain_ret"267267#else268268#define CALL_UNTRAIN_RET ""···280280 * where we have a stack but before any RET instruction.281281 */282282.macro __UNTRAIN_RET ibpb_feature, call_depth_insns283283-#if defined(CONFIG_RETHUNK) || defined(CONFIG_CPU_IBPB_ENTRY)283283+#if defined(CONFIG_MITIGATION_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY)284284 VALIDATE_UNRET_END285285 ALTERNATIVE_3 "", \286286 CALL_UNTRAIN_RET, X86_FEATURE_UNRET, \···300300301301302302.macro CALL_DEPTH_ACCOUNT303303-#ifdef CONFIG_CALL_DEPTH_TRACKING303303+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING304304 ALTERNATIVE "", \305305 __stringify(INCREMENT_CALL_DEPTH), X86_FEATURE_CALL_DEPTH306306#endif···319319extern retpoline_thunk_t __x86_indirect_call_thunk_array[];320320extern retpoline_thunk_t __x86_indirect_jump_thunk_array[];321321322322-#ifdef CONFIG_RETHUNK322322+#ifdef CONFIG_MITIGATION_RETHUNK323323extern void __x86_return_thunk(void);324324#else325325static inline void __x86_return_thunk(void) {}326326#endif327327328328-#ifdef CONFIG_CPU_UNRET_ENTRY328328+#ifdef CONFIG_MITIGATION_UNRET_ENTRY329329extern void retbleed_return_thunk(void);330330#else331331static inline void retbleed_return_thunk(void) {}332332#endif333333334334-#ifdef CONFIG_CPU_SRSO334334+#ifdef CONFIG_MITIGATION_SRSO335335extern void srso_return_thunk(void);336336extern void srso_alias_return_thunk(void);337337#else···348348349349extern void (*x86_return_thunk)(void);350350351351-#ifdef CONFIG_CALL_DEPTH_TRACKING351351+extern void __warn_thunk(void);352352+353353+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING352354extern void call_depth_return_thunk(void);353355354356#define CALL_DEPTH_ACCOUNT \···364362DECLARE_PER_CPU(u64, __x86_stuffs_count);365363DECLARE_PER_CPU(u64, __x86_ctxsw_count);366364#endif367367-#else /* !CONFIG_CALL_DEPTH_TRACKING */365365+#else /* !CONFIG_MITIGATION_CALL_DEPTH_TRACKING */368366369367static inline void call_depth_return_thunk(void) {}370368#define CALL_DEPTH_ACCOUNT ""371369372372-#endif /* CONFIG_CALL_DEPTH_TRACKING */370370+#endif /* CONFIG_MITIGATION_CALL_DEPTH_TRACKING */373371374374-#ifdef CONFIG_RETPOLINE372372+#ifdef CONFIG_MITIGATION_RETPOLINE375373376374#define GEN(reg) \377375 extern retpoline_thunk_t __x86_indirect_thunk_ ## reg;···392390393391/*394392 * Inline asm uses the %V modifier which is only in newer GCC395395- * which is ensured when CONFIG_RETPOLINE is defined.393393+ * which is ensured when CONFIG_MITIGATION_RETPOLINE is defined.396394 */397395# define CALL_NOSPEC \398396 ALTERNATIVE_2( \
+1-1
arch/x86/include/asm/pgalloc.h
···3434 */3535extern gfp_t __userpte_alloc_gfp;36363737-#ifdef CONFIG_PAGE_TABLE_ISOLATION3737+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION3838/*3939 * Instead of one PGD, we acquire two PGDs. Being order-1, it is4040 * both 8k in size and 8k-aligned. That lets us just flip bit 12
···909909pmd_t *populate_extra_pmd(unsigned long vaddr);910910pte_t *populate_extra_pte(unsigned long vaddr);911911912912-#ifdef CONFIG_PAGE_TABLE_ISOLATION912912+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION913913pgd_t __pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd);914914915915/*···923923 return pgd;924924 return __pti_set_user_pgtbl(pgdp, pgd);925925}926926-#else /* CONFIG_PAGE_TABLE_ISOLATION */926926+#else /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */927927static inline pgd_t pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd)928928{929929 return pgd;930930}931931-#endif /* CONFIG_PAGE_TABLE_ISOLATION */931931+#endif /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */932932933933#endif /* __ASSEMBLY__ */934934···11311131{11321132 unsigned long ignore_flags = _KERNPG_TABLE | _PAGE_USER;1133113311341134- if (IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION))11341134+ if (IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION))11351135 ignore_flags |= _PAGE_NX;1136113611371137 return (p4d_flags(p4d) & ~ignore_flags) != 0;···11771177 if (!pgtable_l5_enabled())11781178 return 0;1179117911801180- if (IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION))11801180+ if (IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION))11811181 ignore_flags |= _PAGE_NX;1182118211831183 return (pgd_flags(pgd) & ~ignore_flags) != _KERNPG_TABLE;···14221422#define pgd_leaf pgd_large14231423static inline int pgd_large(pgd_t pgd) { return 0; }1424142414251425-#ifdef CONFIG_PAGE_TABLE_ISOLATION14251425+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION14261426/*14271427- * All top-level PAGE_TABLE_ISOLATION page tables are order-1 pages14271427+ * All top-level MITIGATION_PAGE_TABLE_ISOLATION page tables are order-1 pages14281428 * (8k-aligned and 8k in size). The kernel one is at the beginning 4k and14291429 * the user one is in the last 4k. To switch between them, you14301430 * just need to flip the 12th bit in their addresses.···14691469{14701470 return ptr_clear_bit(p4dp, PTI_PGTABLE_SWITCH_BIT);14711471}14721472-#endif /* CONFIG_PAGE_TABLE_ISOLATION */14721472+#endif /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */1473147314741474/*14751475 * clone_pgd_range(pgd_t *dst, pgd_t *src, int count);···14841484static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)14851485{14861486 memcpy(dst, src, count * sizeof(pgd_t));14871487-#ifdef CONFIG_PAGE_TABLE_ISOLATION14871487+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION14881488 if (!static_cpu_has(X86_FEATURE_PTI))14891489 return;14901490 /* Clone the user space pgd as well */
+2-1
arch/x86/include/asm/pgtable_64.h
···143143{144144 pgd_t pgd;145145146146- if (pgtable_l5_enabled() || !IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION)) {146146+ if (pgtable_l5_enabled() ||147147+ !IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION)) {147148 WRITE_ONCE(*p4dp, p4d);148149 return;149150 }
···544544 return insn->opcode.bytes[0] == 0x0f && (insn->opcode.bytes[1] & 0xf0) == 0x80;545545}546546547547-#if defined(CONFIG_RETPOLINE) && defined(CONFIG_OBJTOOL)547547+#if defined(CONFIG_MITIGATION_RETPOLINE) && defined(CONFIG_OBJTOOL)548548549549/*550550 * CALL/JMP *%\reg···708708 /*709709 * The compiler is supposed to EMIT an INT3 after every unconditional710710 * JMP instruction due to AMD BTC. However, if the compiler is too old711711- * or SLS isn't enabled, we still need an INT3 after indirect JMPs712712- * even on Intel.711711+ * or MITIGATION_SLS isn't enabled, we still need an INT3 after712712+ * indirect JMPs even on Intel.713713 */714714 if (op == JMP32_INSN_OPCODE && i < insn->length)715715 bytes[i++] = INT3_INSN_OPCODE;···769769 }770770}771771772772-#ifdef CONFIG_RETHUNK772772+#ifdef CONFIG_MITIGATION_RETHUNK773773774774/*775775 * Rewrite the compiler generated return thunk tail-calls.···842842}843843#else844844void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }845845-#endif /* CONFIG_RETHUNK */845845+#endif /* CONFIG_MITIGATION_RETHUNK */846846847847-#else /* !CONFIG_RETPOLINE || !CONFIG_OBJTOOL */847847+#else /* !CONFIG_MITIGATION_RETPOLINE || !CONFIG_OBJTOOL */848848849849void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) { }850850void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }851851852852-#endif /* CONFIG_RETPOLINE && CONFIG_OBJTOOL */852852+#endif /* CONFIG_MITIGATION_RETPOLINE && CONFIG_OBJTOOL */853853854854#ifdef CONFIG_X86_KERNEL_IBT855855
···671671 GDS_MITIGATION_HYPERVISOR,672672};673673674674-#if IS_ENABLED(CONFIG_GDS_FORCE_MITIGATION)674674+#if IS_ENABLED(CONFIG_MITIGATION_GDS_FORCE)675675static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FORCE;676676#else677677static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FULL;···982982 return;983983984984 case RETBLEED_CMD_UNRET:985985- if (IS_ENABLED(CONFIG_CPU_UNRET_ENTRY)) {985985+ if (IS_ENABLED(CONFIG_MITIGATION_UNRET_ENTRY)) {986986 retbleed_mitigation = RETBLEED_MITIGATION_UNRET;987987 } else {988988- pr_err("WARNING: kernel not compiled with CPU_UNRET_ENTRY.\n");988988+ pr_err("WARNING: kernel not compiled with MITIGATION_UNRET_ENTRY.\n");989989 goto do_cmd_auto;990990 }991991 break;···994994 if (!boot_cpu_has(X86_FEATURE_IBPB)) {995995 pr_err("WARNING: CPU does not support IBPB.\n");996996 goto do_cmd_auto;997997- } else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY)) {997997+ } else if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) {998998 retbleed_mitigation = RETBLEED_MITIGATION_IBPB;999999 } else {10001000- pr_err("WARNING: kernel not compiled with CPU_IBPB_ENTRY.\n");10001000+ pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n");10011001 goto do_cmd_auto;10021002 }10031003 break;1004100410051005 case RETBLEED_CMD_STUFF:10061006- if (IS_ENABLED(CONFIG_CALL_DEPTH_TRACKING) &&10061006+ if (IS_ENABLED(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) &&10071007 spectre_v2_enabled == SPECTRE_V2_RETPOLINE) {10081008 retbleed_mitigation = RETBLEED_MITIGATION_STUFF;1009100910101010 } else {10111011- if (IS_ENABLED(CONFIG_CALL_DEPTH_TRACKING))10111011+ if (IS_ENABLED(CONFIG_MITIGATION_CALL_DEPTH_TRACKING))10121012 pr_err("WARNING: retbleed=stuff depends on spectre_v2=retpoline\n");10131013 else10141014- pr_err("WARNING: kernel not compiled with CALL_DEPTH_TRACKING.\n");10141014+ pr_err("WARNING: kernel not compiled with MITIGATION_CALL_DEPTH_TRACKING.\n");1015101510161016 goto do_cmd_auto;10171017 }···10211021 case RETBLEED_CMD_AUTO:10221022 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||10231023 boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {10241024- if (IS_ENABLED(CONFIG_CPU_UNRET_ENTRY))10241024+ if (IS_ENABLED(CONFIG_MITIGATION_UNRET_ENTRY))10251025 retbleed_mitigation = RETBLEED_MITIGATION_UNRET;10261026- else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY) && boot_cpu_has(X86_FEATURE_IBPB))10261026+ else if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY) &&10271027+ boot_cpu_has(X86_FEATURE_IBPB))10271028 retbleed_mitigation = RETBLEED_MITIGATION_IBPB;10281029 }10291030···11031102static enum spectre_v2_user_mitigation spectre_v2_user_ibpb __ro_after_init =11041103 SPECTRE_V2_USER_NONE;1105110411061106-#ifdef CONFIG_RETPOLINE11051105+#ifdef CONFIG_MITIGATION_RETPOLINE11071106static bool spectre_v2_bad_module;1108110711091108bool retpoline_module_ok(bool has_retpoline)···14161415 cmd == SPECTRE_V2_CMD_RETPOLINE_GENERIC ||14171416 cmd == SPECTRE_V2_CMD_EIBRS_LFENCE ||14181417 cmd == SPECTRE_V2_CMD_EIBRS_RETPOLINE) &&14191419- !IS_ENABLED(CONFIG_RETPOLINE)) {14181418+ !IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {14201419 pr_err("%s selected but not compiled in. Switching to AUTO select\n",14211420 mitigation_options[i].option);14221421 return SPECTRE_V2_CMD_AUTO;···14391438 return SPECTRE_V2_CMD_AUTO;14401439 }1441144014421442- if (cmd == SPECTRE_V2_CMD_IBRS && !IS_ENABLED(CONFIG_CPU_IBRS_ENTRY)) {14411441+ if (cmd == SPECTRE_V2_CMD_IBRS && !IS_ENABLED(CONFIG_MITIGATION_IBRS_ENTRY)) {14431442 pr_err("%s selected but not compiled in. Switching to AUTO select\n",14441443 mitigation_options[i].option);14451444 return SPECTRE_V2_CMD_AUTO;···1470146914711470static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)14721471{14731473- if (!IS_ENABLED(CONFIG_RETPOLINE)) {14721472+ if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {14741473 pr_err("Kernel not compiled with retpoline; no mitigation available!");14751474 return SPECTRE_V2_NONE;14761475 }···15651564 break;15661565 }1567156615681568- if (IS_ENABLED(CONFIG_CPU_IBRS_ENTRY) &&15671567+ if (IS_ENABLED(CONFIG_MITIGATION_IBRS_ENTRY) &&15691568 boot_cpu_has_bug(X86_BUG_RETBLEED) &&15701569 retbleed_cmd != RETBLEED_CMD_OFF &&15711570 retbleed_cmd != RETBLEED_CMD_STUFF &&···24582457 break;2459245824602459 case SRSO_CMD_SAFE_RET:24612461- if (IS_ENABLED(CONFIG_CPU_SRSO)) {24602460+ if (IS_ENABLED(CONFIG_MITIGATION_SRSO)) {24622461 /*24632462 * Enable the return thunk for generated code24642463 * like ftrace, static_call, etc.···24782477 else24792478 srso_mitigation = SRSO_MITIGATION_SAFE_RET_UCODE_NEEDED;24802479 } else {24812481- pr_err("WARNING: kernel not compiled with CPU_SRSO.\n");24802480+ pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");24822481 }24832482 break;2484248324852484 case SRSO_CMD_IBPB:24862486- if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY)) {24852485+ if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) {24872486 if (has_microcode) {24882487 setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB);24892488 srso_mitigation = SRSO_MITIGATION_IBPB;24902489 }24912490 } else {24922492- pr_err("WARNING: kernel not compiled with CPU_IBPB_ENTRY.\n");24912491+ pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n");24932492 }24942493 break;2495249424962495 case SRSO_CMD_IBPB_ON_VMEXIT:24972497- if (IS_ENABLED(CONFIG_CPU_SRSO)) {24962496+ if (IS_ENABLED(CONFIG_MITIGATION_SRSO)) {24982497 if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) {24992498 setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);25002499 srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT;25012500 }25022501 } else {25032503- pr_err("WARNING: kernel not compiled with CPU_SRSO.\n");25022502+ pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");25042503 }25052504 break;25062505 }···28502849 return cpu_show_common(dev, attr, buf, X86_BUG_GDS);28512850}28522851#endif28522852+28532853+void __warn_thunk(void)28542854+{28552855+ WARN_ONCE(1, "Unpatched return thunk in use. This should not happen!\n");28562856+}
···414414 .align 4415415SYM_DATA(initial_code, .long i386_start_kernel)416416417417-#ifdef CONFIG_PAGE_TABLE_ISOLATION417417+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION418418#define PGD_ALIGN (2 * PAGE_SIZE)419419#define PTI_USER_PGD_FILL 1024420420#else···474474# endif475475 .align PAGE_SIZE /* needs to be page-sized too */476476477477-#ifdef CONFIG_PAGE_TABLE_ISOLATION477477+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION478478 /*479479 * PTI needs another page so sync_initial_pagetable() works correctly480480 * and does not scribble over the data which is placed behind the
+1-1
arch/x86/kernel/head_64.S
···622622#define SYM_DATA_START_PAGE_ALIGNED(name) \623623 SYM_START(name, SYM_L_GLOBAL, .balign PAGE_SIZE)624624625625-#ifdef CONFIG_PAGE_TABLE_ISOLATION625625+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION626626/*627627 * Each PGD needs to be 8k long and 8k aligned. We do not628628 * ever go out to userspace with these, so we do not
+1-1
arch/x86/kernel/kprobes/opt.c
···324324 * However, the kernel built with retpolines or IBT has jump325325 * tables disabled so the check can be skipped altogether.326326 */327327- if (!IS_ENABLED(CONFIG_RETPOLINE) &&327327+ if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) &&328328 !IS_ENABLED(CONFIG_X86_KERNEL_IBT) &&329329 insn_is_indirect_jump(&insn))330330 return 0;
···172172}173173EXPORT_SYMBOL_GPL(arch_static_call_transform);174174175175-#ifdef CONFIG_RETHUNK175175+#ifdef CONFIG_MITIGATION_RETHUNK176176/*177177 * This is called by apply_returns() to fix up static call trampolines,178178 * specifically ARCH_DEFINE_STATIC_CALL_NULL_TRAMP which is recorded as
+5-5
arch/x86/kernel/vmlinux.lds.S
···133133 LOCK_TEXT134134 KPROBES_TEXT135135 SOFTIRQENTRY_TEXT136136-#ifdef CONFIG_RETPOLINE136136+#ifdef CONFIG_MITIGATION_RETPOLINE137137 *(.text..__x86.indirect_thunk)138138 *(.text..__x86.return_thunk)139139#endif···143143 *(.text..__x86.rethunk_untrain)144144 ENTRY_TEXT145145146146-#ifdef CONFIG_CPU_SRSO146146+#ifdef CONFIG_MITIGATION_SRSO147147 /*148148 * See the comment above srso_alias_untrain_ret()'s149149 * definition.···268268 }269269#endif270270271271-#ifdef CONFIG_RETPOLINE271271+#ifdef CONFIG_MITIGATION_RETPOLINE272272 /*273273 * List of instructions that call/jmp/jcc to retpoline thunks274274 * __x86_indirect_thunk_*(). These instructions can be patched along···505505 "fixed_percpu_data is not at start of per-cpu area");506506#endif507507508508-#ifdef CONFIG_CPU_UNRET_ENTRY508508+#ifdef CONFIG_MITIGATION_UNRET_ENTRY509509. = ASSERT((retbleed_return_thunk & 0x3f) == 0, "retbleed_return_thunk not cacheline-aligned");510510#endif511511512512-#ifdef CONFIG_CPU_SRSO512512+#ifdef CONFIG_MITIGATION_SRSO513513. = ASSERT((srso_safe_ret & 0x3f) == 0, "srso_safe_ret not cacheline-aligned");514514/*515515 * GNU ld cannot do XOR until 2.41.
+1-1
arch/x86/kvm/mmu/mmu.c
···263263static inline unsigned long kvm_mmu_get_guest_pgd(struct kvm_vcpu *vcpu,264264 struct kvm_mmu *mmu)265265{266266- if (IS_ENABLED(CONFIG_RETPOLINE) && mmu->get_guest_pgd == get_guest_cr3)266266+ if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && mmu->get_guest_pgd == get_guest_cr3)267267 return kvm_read_cr3(vcpu);268268269269 return mmu->get_guest_pgd(vcpu);
+1-1
arch/x86/kvm/mmu/mmu_internal.h
···315315 if (!prefetch)316316 vcpu->stat.pf_taken++;317317318318- if (IS_ENABLED(CONFIG_RETPOLINE) && fault.is_tdp)318318+ if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) && fault.is_tdp)319319 r = kvm_tdp_page_fault(vcpu, &fault);320320 else321321 r = vcpu->arch.mmu->page_fault(vcpu, &fault);
+1-1
arch/x86/kvm/svm/svm.c
···34553455 if (!svm_check_exit_valid(exit_code))34563456 return svm_handle_invalid_exit(vcpu, exit_code);3457345734583458-#ifdef CONFIG_RETPOLINE34583458+#ifdef CONFIG_MITIGATION_RETPOLINE34593459 if (exit_code == SVM_EXIT_MSR)34603460 return msr_interception(vcpu);34613461 else if (exit_code == SVM_EXIT_VINTR)
+2-2
arch/x86/kvm/svm/vmenter.S
···2072077: vmload %_ASM_AX2082088:209209210210-#ifdef CONFIG_RETPOLINE210210+#ifdef CONFIG_MITIGATION_RETPOLINE211211 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */212212 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE213213#endif···344344 /* Pop @svm to RDI, guest registers have been saved already. */345345 pop %_ASM_DI346346347347-#ifdef CONFIG_RETPOLINE347347+#ifdef CONFIG_MITIGATION_RETPOLINE348348 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */349349 FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE350350#endif
+1-1
arch/x86/kvm/vmx/vmx.c
···6543654365446544 if (exit_reason.basic >= kvm_vmx_max_exit_handlers)65456545 goto unexpected_vmexit;65466546-#ifdef CONFIG_RETPOLINE65466546+#ifdef CONFIG_MITIGATION_RETPOLINE65476547 if (exit_reason.basic == EXIT_REASON_MSR_WRITE)65486548 return kvm_emulate_wrmsr(vcpu);65496549 else if (exit_reason.basic == EXIT_REASON_PREEMPTION_TIMER)
···7171#include <asm/GEN-for-each-reg.h>7272#undef GEN73737474-#ifdef CONFIG_CALL_DEPTH_TRACKING7474+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING7575.macro CALL_THUNK reg7676 .align RETPOLINE_THUNK_SIZE7777···127127#undef GEN128128#endif129129130130-#ifdef CONFIG_RETHUNK130130+#ifdef CONFIG_MITIGATION_RETHUNK131131132132/*133133 * Be careful here: that label cannot really be removed because in···138138 */139139 .section .text..__x86.return_thunk140140141141-#ifdef CONFIG_CPU_SRSO141141+#ifdef CONFIG_MITIGATION_SRSO142142143143/*144144 * srso_alias_untrain_ret() and srso_alias_safe_ret() are placed at···225225226226#define JMP_SRSO_UNTRAIN_RET "jmp srso_untrain_ret"227227#define JMP_SRSO_ALIAS_UNTRAIN_RET "jmp srso_alias_untrain_ret"228228-#else /* !CONFIG_CPU_SRSO */228228+#else /* !CONFIG_MITIGATION_SRSO */229229#define JMP_SRSO_UNTRAIN_RET "ud2"230230#define JMP_SRSO_ALIAS_UNTRAIN_RET "ud2"231231-#endif /* CONFIG_CPU_SRSO */231231+#endif /* CONFIG_MITIGATION_SRSO */232232233233-#ifdef CONFIG_CPU_UNRET_ENTRY233233+#ifdef CONFIG_MITIGATION_UNRET_ENTRY234234235235/*236236 * Some generic notes on the untraining sequences:···312312SYM_FUNC_END(retbleed_untrain_ret)313313314314#define JMP_RETBLEED_UNTRAIN_RET "jmp retbleed_untrain_ret"315315-#else /* !CONFIG_CPU_UNRET_ENTRY */315315+#else /* !CONFIG_MITIGATION_UNRET_ENTRY */316316#define JMP_RETBLEED_UNTRAIN_RET "ud2"317317-#endif /* CONFIG_CPU_UNRET_ENTRY */317317+#endif /* CONFIG_MITIGATION_UNRET_ENTRY */318318319319-#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)319319+#if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_MITIGATION_SRSO)320320321321SYM_FUNC_START(entry_untrain_ret)322322 ALTERNATIVE_2 JMP_RETBLEED_UNTRAIN_RET, \···325325SYM_FUNC_END(entry_untrain_ret)326326__EXPORT_THUNK(entry_untrain_ret)327327328328-#endif /* CONFIG_CPU_UNRET_ENTRY || CONFIG_CPU_SRSO */328328+#endif /* CONFIG_MITIGATION_UNRET_ENTRY || CONFIG_MITIGATION_SRSO */329329330330-#ifdef CONFIG_CALL_DEPTH_TRACKING330330+#ifdef CONFIG_MITIGATION_CALL_DEPTH_TRACKING331331332332 .align 64333333SYM_FUNC_START(call_depth_return_thunk)···359359 int3360360SYM_FUNC_END(call_depth_return_thunk)361361362362-#endif /* CONFIG_CALL_DEPTH_TRACKING */362362+#endif /* CONFIG_MITIGATION_CALL_DEPTH_TRACKING */363363364364/*365365 * This function name is magical and is used by -mfunction-return=thunk-extern···369369 * 'JMP __x86_return_thunk' sites are changed to something else by370370 * apply_returns().371371 *372372- * This should be converted eventually to call a warning function which373373- * should scream loudly when the default return thunk is called after374374- * alternatives have been applied.375375- *376376- * That warning function cannot BUG() because the bug splat cannot be377377- * displayed in all possible configurations, leading to users not really378378- * knowing why the machine froze.372372+ * The ALTERNATIVE below adds a really loud warning to catch the case373373+ * where the insufficient default return thunk ends up getting used for374374+ * whatever reason like miscompilation or failure of375375+ * objtool/alternatives/etc to patch all the return sites.379376 */380377SYM_CODE_START(__x86_return_thunk)381378 UNWIND_HINT_FUNC382379 ANNOTATE_NOENDBR383383- ANNOTATE_UNRET_SAFE384384- ret380380+ ALTERNATIVE __stringify(ANNOTATE_UNRET_SAFE; ret), \381381+ "jmp warn_thunk_thunk", X86_FEATURE_ALWAYS385382 int3386383SYM_CODE_END(__x86_return_thunk)387384EXPORT_SYMBOL(__x86_return_thunk)388385389389-#endif /* CONFIG_RETHUNK */386386+#endif /* CONFIG_MITIGATION_RETHUNK */
···293293 for (i = 0; i < PREALLOCATED_PMDS; i++)294294 mop_up_one_pmd(mm, &pgdp[i]);295295296296-#ifdef CONFIG_PAGE_TABLE_ISOLATION296296+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION297297298298 if (!boot_cpu_has(X86_FEATURE_PTI))299299 return;···325325 }326326}327327328328-#ifdef CONFIG_PAGE_TABLE_ISOLATION328328+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION329329static void pgd_prepopulate_user_pmd(struct mm_struct *mm,330330 pgd_t *k_pgd, pmd_t *pmds[])331331{
+5-5
arch/x86/mm/tlb.c
···8989#define CR3_HW_ASID_BITS 1290909191/*9292- * When enabled, PAGE_TABLE_ISOLATION consumes a single bit for9292+ * When enabled, MITIGATION_PAGE_TABLE_ISOLATION consumes a single bit for9393 * user/kernel switches9494 */9595-#ifdef CONFIG_PAGE_TABLE_ISOLATION9595+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION9696# define PTI_CONSUMED_PCID_BITS 19797#else9898# define PTI_CONSUMED_PCID_BITS 0···114114{115115 VM_WARN_ON_ONCE(asid > MAX_ASID_AVAILABLE);116116117117-#ifdef CONFIG_PAGE_TABLE_ISOLATION117117+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION118118 /*119119 * Make sure that the dynamic ASID space does not conflict with the120120 * bit we are using to switch between user and kernel ASIDs.···149149static inline u16 user_pcid(u16 asid)150150{151151 u16 ret = kern_pcid(asid);152152-#ifdef CONFIG_PAGE_TABLE_ISOLATION152152+#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION153153 ret |= 1 << X86_CR3_PTI_PCID_USER_BIT;154154#endif155155 return ret;···262262static inline void invalidate_user_asid(u16 asid)263263{264264 /* There is no user ASID if address space separation is off */265265- if (!IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION))265265+ if (!IS_ENABLED(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION))266266 return;267267268268 /*
+2-2
arch/x86/net/bpf_jit_comp.c
···553553 emit_jump(&prog, &__x86_indirect_thunk_array[reg], ip);554554 } else {555555 EMIT2(0xFF, 0xE0 + reg); /* jmp *%\reg */556556- if (IS_ENABLED(CONFIG_RETPOLINE) || IS_ENABLED(CONFIG_SLS))556556+ if (IS_ENABLED(CONFIG_MITIGATION_RETPOLINE) || IS_ENABLED(CONFIG_MITIGATION_SLS))557557 EMIT1(0xCC); /* int3 */558558 }559559···568568 emit_jump(&prog, x86_return_thunk, ip);569569 } else {570570 EMIT1(0xC3); /* ret */571571- if (IS_ENABLED(CONFIG_SLS))571571+ if (IS_ENABLED(CONFIG_MITIGATION_SLS))572572 EMIT1(0xCC); /* int3 */573573 }574574
···155155 "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",156156 );157157 let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();158158- if cfg.has("RETPOLINE") {158158+ if cfg.has("MITIGATION_RETPOLINE") {159159 features += ",+retpoline-external-thunk";160160 }161161 ts.push("features", features);
···8383 * TODO: Once we have DWARF CFI and smarter instruction decoding logic,8484 * ensure the same register is used in the mov and jump instructions.8585 *8686- * NOTE: RETPOLINE made it harder still to decode dynamic jumps.8686+ * NOTE: MITIGATION_RETPOLINE made it harder still to decode dynamic jumps.8787 */8888struct reloc *arch_find_switch_table(struct objtool_file *file,8989 struct instruction *insn)
+2-2
tools/objtool/check.c
···3980398039813981 if (insn->type == INSN_RETURN) {39823982 if (opts.rethunk) {39833983- WARN_INSN(insn, "'naked' return found in RETHUNK build");39833983+ WARN_INSN(insn, "'naked' return found in MITIGATION_RETHUNK build");39843984 } else39853985 continue;39863986 } else {39873987- WARN_INSN(insn, "indirect %s found in RETPOLINE build",39873987+ WARN_INSN(insn, "indirect %s found in MITIGATION_RETPOLINE build",39883988 insn->type == INSN_JUMP_DYNAMIC ? "jump" : "call");39893989 }39903990