summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cfi.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/cfi.c')
-rw-r--r--arch/x86/kernel/cfi.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/kernel/cfi.c b/arch/x86/kernel/cfi.c
index 638eb5c933e0..1df26dfdce08 100644
--- a/arch/x86/kernel/cfi.c
+++ b/arch/x86/kernel/cfi.c
@@ -72,8 +72,15 @@ enum bug_trap_type handle_cfi_failure(struct pt_regs *regs)
switch (cfi_mode) {
case CFI_KCFI:
- if (!is_cfi_trap(addr))
- return BUG_TRAP_TYPE_NONE;
+ if (!is_cfi_trap(addr)) {
+ /*
+ * The updated kCFI sequence has "test $0xd6, %al" instead of
+ * "ud2", adjust the offset.
+ */
+ addr -= 1;
+ if (!is_cfi_trap(addr))
+ return BUG_TRAP_TYPE_NONE;
+ }
if (!decode_cfi_insn(regs, &target, &type))
return report_cfi_failure_noaddr(regs, addr);