HomeFreeBSD

amd64: Populate the KMSAN shadow maps and integrate with the VM

Description

amd64: Populate the KMSAN shadow maps and integrate with the VM

  • During boot, allocate PDP pages for the shadow maps. The region above KERNBASE is currently not shadowed.
  • Create a dummy shadow for the vm page array. For now, this array is not protected by the shadow map to help reduce kernel memory usage.
  • Grow shadows when growing the kernel map.
  • Increase the default kernel stack size when KMSAN is enabled. As with KASAN, sanitizer instrumentation appears to create stack frames large enough that the default value is not sufficient.
  • Disable UMA's use of the direct map when KMSAN is configured. KMSAN cannot validate the direct map.
  • Disable unmapped I/O when KMSAN configured.
  • Lower the limit on paging buffers when KMSAN is configured. Each buffer has a static MAXPHYS-sized allocation of KVA, which in turn eats 2*MAXPHYS of space in the shadow map.

Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31295

Details

Provenance
markjAuthored on Aug 10 2021, 8:52 PM
Reviewer
alc
Differential Revision
D31295: amd64: Introduce KMSAN shadow maps
Parents
R10:5dda15adbcf7: kern: Ensure that thread-local KMSAN state is available
Branches
Unknown
Tags
Unknown