You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ARM][KCFI] Add backend support for Kernel Control-Flow Integrity
Implement KCFI (Kernel Control Flow Integrity) backend support for ARM32
(ARM mode only, not Thumb), as is already supported for x86, aarch64,
and riscv. The Linux kernel has supported ARM KCFI via Clang's generic
KCFI implementation, but this has finally started to
[cause problems](ClangBuiltLinux/linux#2124)
so it's time to get the KCFI operand bundle lowering working on ARM.
Implementation notes:
- Four-instruction EOR sequence builds the 32-bit type ID byte-by-byte
to work within ARM's modified immediate encoding constraints.
- Scratch register selection: r12 (IP) is preferred, r3 used as fallback
when r12 holds the call target
- Automatic r3 spill/reload when r3 is live as a call argument (5+ args)
- UDF trap encoding: 0x8000 | (0x1F << 5) | target_reg_index, similar
to aarch64's trap encoding.
- Support for patchable-function-prefix with adjusted load offsets
- Only enabled for ARM mode
Frontend integration updated to skip the KCFI IR pass for ARM targets,
allowing the backend to handle KCFI operand bundle lowering directly,
matching the implementation used by the other architectures.
0 commit comments