]> git.baikalelectronics.ru Git - 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)
committerBorislav Petkov <bp@suse.de>
Fri, 3 Dec 2021 18:13:53 +0000 (19:13 +0100)
commit88d1548f8cce4c922f6167c18943195df0e97d8e
tree19d948b14420f3ff5327c15adfea84543e7bd4d2
parent1ef48a7c6e8a8f93d4bb4c365afc15f0a1f0b785
x86/entry: Use the correct fence macro after swapgs in kernel CR3

The commit

  75902f6dc425 ("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: 75902f6dc425 ("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
arch/x86/entry/entry_64.S