diff options
author | 2019-09-05 11:40:54 +0200 | |
---|---|---|
committer | 2019-09-05 11:40:54 +0200 | |
commit | 151a41014bff92f353263cadc051435dc9c3258e (patch) | |
tree | aa082a0745edd5b7051668f455dfc0ee1e4a9de0 /arch/x86/entry/calling.h | |
parent | gpio: Fix up merge collision in include file (diff) | |
parent | Linux 5.3-rc7 (diff) | |
download | wireguard-linux-151a41014bff92f353263cadc051435dc9c3258e.tar.xz wireguard-linux-151a41014bff92f353263cadc051435dc9c3258e.zip |
Merge tag 'v5.3-rc7' into devel
Linux 5.3-rc7
Diffstat (limited to '')
-rw-r--r-- | arch/x86/entry/calling.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index 830bd984182b..515c0ceeb4a3 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 #endif +/* + * Mitigate Spectre v1 for conditional swapgs code paths. + * + * FENCE_SWAPGS_USER_ENTRY is used in the user entry swapgs code path, to + * prevent a speculative swapgs when coming from kernel space. + * + * FENCE_SWAPGS_KERNEL_ENTRY is used in the kernel entry non-swapgs code path, + * to prevent the swapgs from getting speculatively skipped when coming from + * user space. + */ +.macro FENCE_SWAPGS_USER_ENTRY + ALTERNATIVE "", "lfence", X86_FEATURE_FENCE_SWAPGS_USER +.endm +.macro FENCE_SWAPGS_KERNEL_ENTRY + ALTERNATIVE "", "lfence", X86_FEATURE_FENCE_SWAPGS_KERNEL +.endm + .macro STACKLEAK_ERASE_NOCLOBBER #ifdef CONFIG_GCC_PLUGIN_STACKLEAK PUSH_AND_CLEAR_REGS |