HomeFreeBSD

arm64: add KASAN support

Description

arm64: add KASAN support

This entails:

  • Marking some obvious candidates for __nosanitizeaddress
  • Similar trap frame markings as amd64, for similar reasons
  • Shadow map implementation

The shadow map implementation is roughly similar to what was done on
amd64, with some exceptions. Attempting to use available space at
preinit_map_va + PMAP_PREINIT_MAPPING_SIZE (up to the end of that range,
as depicted in the physmap) results in odd failures, so we instead
search the physmap for free regions that we can carve out, fragmenting
the shadow map as necessary to try and fit as much as we need for the
initial kernel map. pmap_bootstrap_san() is thus after
pmap_bootstrap(), which still included some technically reserved areas
of the memory map that needed to be included in the DMAP.

The odd failure noted above may be a bug, but I haven't investigated it
all that much.

Initial work by mhorne with additional fixes from kevans and markj.

Reviewed by: andrew, markj
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36701

Details

Provenance
kevansAuthored on Mar 23 2023, 9:26 PM
Reviewer
andrew
Differential Revision
D36701: arm64: add KASAN support
Parents
rG698dbd66fed2: arm64: add a GENERIC-KASAN config
Branches
Unknown
Tags
Unknown