HomeFreeBSD

arm64: Add BTI landing pads to assembly functions

Description

arm64: Add BTI landing pads to assembly functions

When we enable BTI iboth the first instruction in a function that could
be called indirectly, and a branch within a function need a valid
landing pad instruction.

There are three options for these instructions:

  1. A breakpoint instruction
  2. A pointer authentication PACIASP/PACIBSP
  3. A BTI instruction

Option 1 will raise a breakpoint exception so isn't useable in either
cases. Option 2 could be used in some function entry cases, but needs
to be paired with an authentication instruction, and is normally only
used in non-leaf functions we can't use it in this case. This leaves
option 3.

There are four variants of the instruction, the C variant is used on
function entry and the J variant is for jumping within a function.
There is also a JC that works with both and one with no target that
works with neither.

Reviewed by: markj
Sponsored by: Arm Ltd
Sponsored by: The FreeBSD Foundation (earlier version)
Differential Revision: https://reviews.freebsd.org/D42078

Details

Provenance
andrewAuthored on Oct 3 2023, 8:52 AM
Reviewer
markj
Differential Revision
D42078: arm64: Add BTI landing pads to assembly functions
Parents
rGebfd3b229af1: pf: move DIOCGETSTATES(V2) to COMPAT_FREEBSD14
Branches
Unknown
Tags
Unknown