diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2023-03-23 21:26:06 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2023-03-23 21:34:33 +0000 |
commit | 89c52f9d59fa796cc6cce44d34c93ec802abb15a (patch) | |
tree | 105f720ac7bfad2cf415c7a6bc5b9548e7524017 /sys/arm64/include/vmparam.h | |
parent | 698dbd66fed21e0acabf02a07be5080d016efa5c (diff) | |
download | src-89c52f9d59fa.tar.gz src-89c52f9d59fa.zip |
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
Diffstat (limited to 'sys/arm64/include/vmparam.h')
-rw-r--r-- | sys/arm64/include/vmparam.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h index e3f48e61b78c..b28a79256453 100644 --- a/sys/arm64/include/vmparam.h +++ b/sys/arm64/include/vmparam.h @@ -125,7 +125,10 @@ * Upper region: 0xffffffffffffffff Top of virtual memory * * 0xfffffeffffffffff End of DMAP - * 0xfffffa0000000000 Start of DMAP + * 0xffffa00000000000 Start of DMAP + * + * 0xffff009fffffffff End of KASAN shadow map + * 0xffff008000000000 Start of KASAN shadow map * * 0xffff007fffffffff End of KVA * 0xffff000000000000 Kernel base address & start of KVA @@ -156,6 +159,10 @@ #define VM_MIN_KERNEL_ADDRESS (0xffff000000000000UL) #define VM_MAX_KERNEL_ADDRESS (0xffff008000000000UL) +/* 128 GiB KASAN shadow map */ +#define KASAN_MIN_ADDRESS (0xffff008000000000UL) +#define KASAN_MAX_ADDRESS (0xffff00a000000000UL) + /* The address bits that hold a pointer authentication code */ #define PAC_ADDR_MASK (0xff7f000000000000UL) @@ -239,7 +246,9 @@ #define VM_INITIAL_PAGEIN 16 #endif +#if !defined(KASAN) && !defined(KMSAN) #define UMA_MD_SMALL_ALLOC +#endif #ifndef LOCORE |