Commit 1367afa
x86/entry: Use the correct fence macro after swapgs in kernel CR3
The commit
c758907 ("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: c758907 ("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.com1 parent c07e455 commit 1367afa
1 file changed
+8
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
987 | 987 | | |
988 | 988 | | |
989 | 989 | | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | 990 | | |
996 | 991 | | |
997 | 992 | | |
| |||
1014 | 1009 | | |
1015 | 1010 | | |
1016 | 1011 | | |
1017 | | - | |
1018 | | - | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
1019 | 1020 | | |
1020 | 1021 | | |
1021 | 1022 | | |
| |||
0 commit comments