Commit c07e455
x86/entry: Add a fence for kernel entry SWAPGS in paranoid_entry()
Commit
18ec54f ("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
96b2371 ("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: 96b2371 ("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.com1 parent 1d5379d commit c07e455
1 file changed
+5
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
| 893 | + | |
893 | 894 | | |
894 | 895 | | |
895 | 896 | | |
896 | 897 | | |
897 | 898 | | |
898 | 899 | | |
899 | 900 | | |
900 | | - | |
901 | | - | |
| 901 | + | |
902 | 902 | | |
903 | | - | |
| 903 | + | |
| 904 | + | |
904 | 905 | | |
| 906 | + | |
905 | 907 | | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | 908 | | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | 909 | | |
916 | 910 | | |
917 | 911 | | |
| |||
0 commit comments