OrangePi_CM5/arch/x86/entry
Lai Jiangshan 92f309c838 x86/entry: Add a fence for kernel entry SWAPGS in paranoid_entry()
[ Upstream commit c07e45553da1808aa802e9f0ffa8108cfeaf7a17 ]

Commit

  18ec54fdd6 ("x86/speculation: Prepare entry code for Spectre v1 swapgs mitigations")

added FENCE_SWAPGS_{KERNEL|USER}_ENTRY for conditional SWAPGS. In
paranoid_entry(), it uses only FENCE_SWAPGS_KERNEL_ENTRY for both
branches. This is because the fence is required for both cases since the
CR3 write is conditional even when PTI is enabled.

But

  96b2371413 ("x86/entry/64: Switch CR3 before SWAPGS in paranoid entry")

changed the order of SWAPGS and the CR3 write. And it missed the needed
FENCE_SWAPGS_KERNEL_ENTRY for the user gsbase case.

Add it back by changing the branches so that FENCE_SWAPGS_KERNEL_ENTRY
can cover both branches.

  [ bp: Massage, fix typos, remove obsolete comment while at it. ]

Fixes: 96b2371413 ("x86/entry/64: Switch CR3 before SWAPGS in paranoid entry")
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211126101209.8613-2-jiangshanlai@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-12-08 09:03:27 +01:00
..
syscalls A couple of x86 fixes which missed rc1 due to my stupidity: 2020-10-27 14:39:29 -07:00
vdso Kbuild updates for v5.10 2020-10-22 13:13:57 -07:00
vsyscall
…
Makefile
…
calling.h
…
common.c x86/entry: Fix noinstr fail in __do_fast_syscall_32() 2021-06-30 08:47:17 -04:00
entry_32.S
…
entry_64.S x86/entry: Add a fence for kernel entry SWAPGS in paranoid_entry() 2021-12-08 09:03:27 +01:00
entry_64_compat.S x86/sev-es: Introduce ip_within_syscall_gap() helper 2021-03-17 17:06:35 +01:00
syscall_32.c
…
syscall_64.c
…
syscall_x32.c
…
thunk_32.S
…
thunk_64.S x86/entry: Emit a symbol for register restoring thunk 2021-02-03 23:28:40 +01:00