Commit ebebe30
x86/ibt: Keep IBT disabled during alternative patching
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.
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>1 parent d6d1e3e commit ebebe30
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
2085 | 2086 | | |
2086 | 2087 | | |
2087 | 2088 | | |
| 2089 | + | |
| 2090 | + | |
2088 | 2091 | | |
2089 | 2092 | | |
2090 | 2093 | | |
| |||
2111 | 2114 | | |
2112 | 2115 | | |
2113 | 2116 | | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
2114 | 2120 | | |
2115 | 2121 | | |
2116 | 2122 | | |
| |||
2134 | 2140 | | |
2135 | 2141 | | |
2136 | 2142 | | |
| 2143 | + | |
| 2144 | + | |
2137 | 2145 | | |
2138 | 2146 | | |
2139 | 2147 | | |
| |||
0 commit comments