HomeFreeBSD

arm64: Enable kernel branch protection

Description

arm64: Enable kernel branch protection

Add the build flags to enable branch protection on arm64. This enable
the use of PAC and BTI in the kernel.

For PAC we already install the kernel keys when entering the kernel
from userspace so this will start using these to sign the stack.

For BTI we need to mark the kernel page tables with a new guarded page
field. As this will require all code that could be reached through a
function pointer with an appropriate branch target instruction we
are enabling this before setting the field.

As the pointer authentication support shouldn't be reached via a
function pointer it is safe to not enable the use of BTI there.

Reviewed by: markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42079

Details

Provenance
andrewAuthored on Oct 2 2023, 3:55 PM
Reviewer
markj
Differential Revision
D42079: arm64: Enable kernel branch protection
Parents
rGe340882d3e49: arm64: Add BTI landing pads to assembly functions
Branches
Unknown
Tags
Unknown