Commit 04505bb
Peter Zijlstra
x86/fineibt: Poison ENDBR at +0
Alyssa noticed that when building the kernel with CFI_CLANG+IBT and
booting on IBT enabled hardware to obtain FineIBT, the indirect
functions look like:
__cfi_foo:
endbr64
subl $hash, %r10d
jz 1f
ud2
nop
1:
foo:
endbr64
This is because the compiler generates code for kCFI+IBT. In that case
the caller does the hash check and will jump to +0, so there must be
an ENDBR there. The compiler doesn't know about FineIBT at all; also
it is possible to actually use kCFI+IBT when booting with 'cfi=kcfi'
on IBT enabled hardware.
Having this second ENDBR however makes it possible to elide the CFI
check. Therefore, we should poison this second ENDBR when switching to
FineIBT mode.
Fixes: 931ab63 ("x86/ibt: Implement FineIBT")
Reported-by: "Milburn, Alyssa" <alyssa.milburn@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20230615193722.194131053@infradead.org1 parent 3aec4ec commit 04505bb
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1068 | 1068 | | |
1069 | 1069 | | |
1070 | 1070 | | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
1071 | 1082 | | |
1072 | 1083 | | |
1073 | 1084 | | |
| |||
1162 | 1173 | | |
1163 | 1174 | | |
1164 | 1175 | | |
| 1176 | + | |
1165 | 1177 | | |
1166 | 1178 | | |
1167 | 1179 | | |
1168 | 1180 | | |
| 1181 | + | |
1169 | 1182 | | |
1170 | 1183 | | |
1171 | 1184 | | |
1172 | 1185 | | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
1173 | 1189 | | |
1174 | 1190 | | |
1175 | 1191 | | |
| |||
0 commit comments