Re: [PATCH v3] ARM: traps: Implement KCFI trap handler for ARM32

From: Karl Mehltretter

Date: Sun Jul 26 2026 - 20:11:04 EST


On Wed, Jul 15, 2026 at 10:52:27AM +0100, Kees Cook wrote:
> +bool arm_cfi_handle_failure(struct pt_regs *regs, enum bug_trap_type type)
> +{
> + switch (type) {
> + case BUG_TRAP_TYPE_BUG:
> + die("Oops - CFI", regs, 0);
> + break;
> + case BUG_TRAP_TYPE_WARN:
> + /* Permissive mode: skip the trapping instruction and continue. */
> + instruction_pointer(regs) += 4;
> + break;

On Thumb-2, Clang emits a 16-bit BKPT for CFI checks.
This skips the following Thumb instruction.

Thanks,
Karl