Commit 9502e83
x86/ibt: Keep IBT disabled during alternative patching
commit ebebe30794d38c51f71fe4951ba6af4159d9837d upstream.
cfi_rewrite_callers() updates the fineIBT hash matching at the caller side,
but except for paranoid-mode it relies on apply_retpoline() and friends for
any ENDBR relocation. This could temporarily cause an indirect branch to
land on a poisoned ENDBR.
For instance, with para-virtualization enabled, a simple wrmsrl() could
have an indirect branch pointing to native_write_msr() who's ENDBR has been
relocated due to fineIBT:
<wrmsrl>:
push %rbp
mov %rsp,%rbp
mov %esi,%eax
mov %rsi,%rdx
shr $0x20,%rdx
mov %edi,%edi
mov %rax,%rsi
call *0x21e65d0(%rip) # <pv_ops+0xb8>
^^^^^^^^^^^^^^^^^^^^^^^
Such an indirect call during the alternative patching could #CP if the
caller is not *yet* adjusted for the new target ENDBR. To prevent a false
#CP, keep CET-IBT disabled until all callers are patched.
Patching during the module load does not need to be guarded by IBT-disable
because the module code is not executed until the patching is complete.
[ pawan: Since apply_paravirt() happens before __apply_fineibt()
relocates the ENDBR, pv_ops in the example above is not relevant.
It is still safer to keep this commit because missing an ENDBR
means an oops. ]
Signed-off-by: Pawan Gupta <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Reviewed-by: Alexandre Chartre <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent e6da4a8 commit 9502e83
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
1006 | 1007 | | |
1007 | 1008 | | |
1008 | 1009 | | |
| 1010 | + | |
| 1011 | + | |
1009 | 1012 | | |
1010 | 1013 | | |
1011 | 1014 | | |
| |||
1043 | 1046 | | |
1044 | 1047 | | |
1045 | 1048 | | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1046 | 1052 | | |
1047 | 1053 | | |
1048 | 1054 | | |
| |||
1064 | 1070 | | |
1065 | 1071 | | |
1066 | 1072 | | |
| 1073 | + | |
| 1074 | + | |
1067 | 1075 | | |
1068 | 1076 | | |
1069 | 1077 | | |
| |||
0 commit comments