freebsd-dev/sys/conf
Mark Johnston 38da497a4d Add the KASAN runtime
KASAN enables the use of LLVM's AddressSanitizer in the kernel.  This
feature makes use of compiler instrumentation to validate memory
accesses in the kernel and detect several types of bugs, including
use-after-frees and out-of-bounds accesses.  It is particularly
effective when combined with test suites or syzkaller.  KASAN has high
CPU and memory usage overhead and so is not suited for production
environments.

The runtime and pmap maintain a shadow of the kernel map to store
information about the validity of memory mapped at a given kernel
address.

The runtime implements a number of functions defined by the compiler
ABI.  These are prefixed by __asan.  The compiler emits calls to
__asan_load*() and __asan_store*() around memory accesses, and the
runtime consults the shadow map to determine whether a given access is
valid.

kasan_mark() is called by various kernel allocators to update state in
the shadow map.  Updates to those allocators will come in subsequent
commits.

The runtime also defines various interceptors.  Some low-level routines
are implemented in assembly and are thus not amenable to compiler
instrumentation.  To handle this, the runtime implements these routines
on behalf of the rest of the kernel.  The sanitizer implementation
validates memory accesses manually before handing off to the real
implementation.

The sanitizer in a KASAN-configured kernel can be disabled by setting
the loader tunable debug.kasan.disable=1.

Obtained from:	NetBSD
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29416
2021-04-13 17:42:20 -04:00
..
config.mk
dtb.build.mk Switch to the new device-tree vendor tree 2021-01-15 20:08:39 +01:00
dtb.mk
files Add the KASAN runtime 2021-04-13 17:42:20 -04:00
files.amd64 x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
files.arm x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
files.arm64 Merge the QorIQ GPIO drivers between arm and powerpc 2021-04-05 10:35:15 -05:00
files.i386 x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
files.mips amd64: implement strlen in assembly 2021-02-08 19:15:21 +00:00
files.powerpc Merge the QorIQ GPIO drivers between arm and powerpc 2021-04-05 10:35:15 -05:00
files.riscv amd64: implement strlen in assembly 2021-02-08 19:15:21 +00:00
files.x86 hptrr: Move to using .o files 2021-04-12 13:47:55 -06:00
kern.mk Don't add -Winline for WARNS=6 2021-03-22 11:55:45 +00:00
kern.opts.mk WITH_OFED build option: fix 2021-02-02 18:44:52 +02:00
kern.post.mk x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
kern.pre.mk Add a KASAN option to the kernel build 2021-04-13 17:42:20 -04:00
kmod_syms_prefix.awk
kmod_syms.awk
kmod.mk conf/kern.mk: save some work by using realpath instead of cd ; pwd 2021-01-27 12:41:33 +00:00
kmod.opts.mk
ldscript.amd64
ldscript.arm
ldscript.arm64
ldscript.i386
ldscript.kmod.amd64
ldscript.kmod.i386
ldscript.mips
ldscript.mips.cfe
ldscript.mips.mips64
ldscript.mips.octeon1
ldscript.powerpc
ldscript.powerpc64
ldscript.powerpc64le
ldscript.powerpcspe
ldscript.riscv
Makefile.amd64
Makefile.arm x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
Makefile.arm64 arm64: Check dtb version against the one we're expecting to find 2021-03-23 15:24:53 +01:00
Makefile.i386
Makefile.mips mips: Add the device-tree path to the include paths 2021-01-16 11:33:37 +01:00
Makefile.powerpc
Makefile.riscv riscv: Add the device-tree path to the include path 2021-01-16 11:31:17 +01:00
newvers.sh newvers: tweak uname to be more useful 2021-01-28 17:44:56 -07:00
NOTES retire obsolete mn(4) sync serial driver 2021-03-22 15:06:51 -04:00
options Add a KASAN option to the kernel build 2021-04-13 17:42:20 -04:00
options.amd64 Remove stale references to opt_sio.h 2021-02-25 21:43:12 -04:00
options.arm
options.arm64 Use L2 blocks when in the identity map 2021-03-03 14:18:03 +00:00
options.i386 x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
options.mips
options.powerpc
options.riscv
std.nodebug
sysent.mk
systags.sh
WITHOUT_SOURCELESS
WITHOUT_SOURCELESS_HOST
WITHOUT_SOURCELESS_UCODE