Mark Johnston 6faf45b34b amd64: Implement a KASAN shadow map
The idea behind KASAN is to use a region of memory to track the validity
of buffers in the kernel map.  This region is the shadow map.  The
compiler inserts calls to the KASAN runtime for every emitted load
and store, and the runtime uses the shadow map to decide whether the
access is valid.  Various kernel allocators call kasan_mark() to update
the shadow map.

Since the shadow map tracks only accesses to the kernel map, accesses to
other kernel maps are not validated by KASAN.  UMA_MD_SMALL_ALLOC is
disabled when KASAN is configured to reduce usage of the direct map.
Currently we have no mechanism to completely eliminate uses of the
direct map, so KASAN's coverage is not comprehensive.

The shadow map uses one byte per eight bytes in the kernel map.  In
pmap_bootstrap() we create an initial set of page tables for the kernel
and preloaded data.

When pmap_growkernel() is called, we call kasan_shadow_map() to extend
the shadow map.  kasan_shadow_map() uses pmap_kasan_enter() to allocate
memory for the shadow region and map it.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29417
2021-04-13 17:42:20 -04:00
..
2021-04-13 17:42:20 -04:00
2021-04-12 06:16:31 +00:00
2021-01-02 19:57:58 -07:00
2021-04-13 17:42:20 -04:00
2021-04-13 18:04:43 +03:00
2021-01-15 20:09:55 +01:00
2021-04-07 14:33:02 -04:00
2021-04-13 17:42:20 -04:00
2021-04-02 15:41:51 +03:00
2021-04-12 13:47:55 -06:00
2021-03-17 06:16:31 +11:00
2021-03-17 06:16:31 +11:00
2021-04-13 17:42:20 -04:00