]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
x86/entry: Use the correct fence macro after swapgs in kernel CR3
authorLai Jiangshan <laijs@linux.alibaba.com>
Fri, 26 Nov 2021 10:11:22 +0000 (18:11 +0800)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:11 +0000 (09:49 +0100)
commit2347f1addce8cf3f26eae32bbba4d5627dd8d65c
treedd03d1984b23b22fb48528bfb56c6fa95ffc48d5
parent488d5b3b2d766447d7775bdd28ffebd5f55266be
x86/entry: Use the correct fence macro after swapgs in kernel CR3

BugLink: https://bugs.launchpad.net/bugs/1953731
[ Upstream commit 1367afaa2ee90d1c956dfc224e199fcb3ff3f8cc ]

The commit

  c75890700455 ("x86/entry/64: Remove unneeded kernel CR3 switching")

removed a CR3 write in the faulting path of load_gs_index().

But the path's FENCE_SWAPGS_USER_ENTRY has no fence operation if PTI is
enabled, see spectre_v1_select_mitigation().

Rather, it depended on the serializing CR3 write of SWITCH_TO_KERNEL_CR3
and since it got removed, add a FENCE_SWAPGS_KERNEL_ENTRY call to make
sure speculation is blocked.

 [ bp: Massage commit message and comment. ]

Fixes: c75890700455 ("x86/entry/64: Remove unneeded kernel CR3 switching")
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20211126101209.8613-3-jiangshanlai@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/x86/entry/entry_64.S