aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/entry/calling.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/entry/calling.h')
-rw-r--r--arch/x86/entry/calling.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h
index 9f1f9e3b8230..7ce7ac9d9d3f 100644
--- a/arch/x86/entry/calling.h
+++ b/arch/x86/entry/calling.h
@@ -314,6 +314,23 @@ For 32-bit we have the following conventions - kernel is built with
314 314
315#endif 315#endif
316 316
317/*
318 * Mitigate Spectre v1 for conditional swapgs code paths.
319 *
320 * FENCE_SWAPGS_USER_ENTRY is used in the user entry swapgs code path, to
321 * prevent a speculative swapgs when coming from kernel space.
322 *
323 * FENCE_SWAPGS_KERNEL_ENTRY is used in the kernel entry non-swapgs code path,
324 * to prevent the swapgs from getting speculatively skipped when coming from
325 * user space.
326 */
327.macro FENCE_SWAPGS_USER_ENTRY
328 ALTERNATIVE "", "lfence", X86_FEATURE_FENCE_SWAPGS_USER
329.endm
330.macro FENCE_SWAPGS_KERNEL_ENTRY
331 ALTERNATIVE "", "lfence", X86_FEATURE_FENCE_SWAPGS_KERNEL
332.endm
333
317.macro STACKLEAK_ERASE_NOCLOBBER 334.macro STACKLEAK_ERASE_NOCLOBBER
318#ifdef CONFIG_GCC_PLUGIN_STACKLEAK 335#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
319 PUSH_AND_CLEAR_REGS 336 PUSH_AND_CLEAR_REGS