mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
ARM: 9481/2: breakpoint: CFI breakpoints only on demand
This removes the stub hw_breakpoint_cfi_handler() from ARM, making
it not steal breakpoint type 0x03 (ARM_ENTRY_CFI_BREAKPOINT) unless
CFI is actively used in the kernel.
When not instrumenting with CFI, or when a breakpoint is issued in
userspace, we fall through to return 1 from hw_breakpoint_pending()
"unhandled fault" so userspace can make use of this breakpoint.
Tested with LKDTM and this command line:
echo CFI_FORWARD_PROTO > /sys/kernel/debug/provoke-crash/DIRECT
still works as expected.
Closes: https://lore.kernel.org/lkml/kJqktbpLphg_Pk5I5SPptgTLjl3E3eq5mN5UzCslyFj7Q1Irp-wDid4mj5eQVd2iZtRGXgeZd8goq195EkXdjyt864YMc8mVb2B9NGH91NQ=@protonmail.com/
Fixes: c3f89986fd ("ARM: 9391/2: hw_breakpoint: Handle CFI breakpoints")
Reported-by: slipher <slipher@protonmail.com>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
This commit is contained in:
parent
7e8ee82e69
commit
8ed9bff906
|
|
@ -929,10 +929,6 @@ static void hw_breakpoint_cfi_handler(struct pt_regs *regs)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void hw_breakpoint_cfi_handler(struct pt_regs *regs)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -964,9 +960,14 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
|
|||
case ARM_ENTRY_SYNC_WATCHPOINT:
|
||||
watchpoint_handler(addr, fsr, regs);
|
||||
break;
|
||||
#ifdef CONFIG_CFI
|
||||
case ARM_ENTRY_CFI_BREAKPOINT:
|
||||
hw_breakpoint_cfi_handler(regs);
|
||||
if (user_mode(regs))
|
||||
ret = 1; /* Don't handle userspace BKPT */
|
||||
else
|
||||
hw_breakpoint_cfi_handler(regs);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ret = 1; /* Unhandled fault. */
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user