freebsd-nq/share
Mark Johnston 48d2c7cc30 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
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 38da497a4d)
2021-11-01 09:56:31 -04:00
..
colldef Add collation version support to querylocale(3). 2020-11-08 02:50:34 +00:00
ctypedef Fix CTYPE for ja_JP.eucJP and ja_JP.SJIS. 2020-06-29 03:23:13 +00:00
dict
doc pkgbase: Install atf and kyua in the tests package 2021-01-04 16:20:47 +01:00
dtrace dtrace: fix ipfw_rule_info_t translator 2021-09-10 13:35:35 +03:00
examples ses: Correct spelling of "Temperature Sensor" 2021-10-07 15:40:56 -06:00
i18n Remove mkcsmapper_static and mkesdb_static from build-tools 2021-08-05 10:00:56 +01:00
keys
man Add the KASAN runtime 2021-11-01 09:56:31 -04:00
misc pci_vendors: update to 2021.09.19 2021-09-22 12:05:56 +02:00
mk Flip the default for OPENSSL_KTLS to arm64 2021-10-08 11:29:10 -07:00
monetdef
msgdef
numericdef
security
sendmail
skel
snmp pkgbase: Put the mibs and defs in the bnsmp package 2021-06-30 09:24:33 +02:00
syscons syscons: scrnmaps: appease -Wmissing-variable-declarations 2021-01-01 11:53:47 -06:00
tabset
termcap Update the screen termcap entries 2020-05-07 12:43:28 +00:00
tests
timedef
vt vt/fonts: fix typo 2020-12-02 09:42:02 +00:00
zoneinfo pkgbase: Put zoneinfo file in their own package 2021-01-04 16:18:36 +01:00
Makefile
Makefile.inc