Page MenuHomeFreeBSD

arm64: Mark EFI memory as userspace non-executable
ClosedPublic

Authored by andrew on Sep 26 2025, 11:46 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 12, 4:37 PM
Unknown Object (File)
Fri, Dec 12, 3:02 AM
Unknown Object (File)
Nov 25 2025, 11:48 AM
Unknown Object (File)
Nov 5 2025, 7:23 AM
Unknown Object (File)
Nov 3 2025, 10:27 AM
Unknown Object (File)
Nov 1 2025, 7:40 AM
Unknown Object (File)
Oct 30 2025, 4:22 AM
Unknown Object (File)
Oct 29 2025, 4:24 AM
Subscribers

Details

Summary

FEAT_PAN3 adds the SCTLR_EL1.EPAN field. This tells the hardware to
raise a permission abort when userspace could execute a page, i.e. the
ATTR_S1_UXN field is clear in the page table.

This causes issues for the EFI runtime as we only mark non-executable
pages with this flag leading to a permission fault when accessing it.

Fix this by marking all EFI mappings with ATTR_S1_UXN. The kernel
already had this field set so was already safe.

Reported by: tuexen
Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable