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

Karl Mehltretter kmehltretter at gmail.com
Sun Jul 26 17:10:19 PDT 2026


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



More information about the linux-arm-kernel mailing list