]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Simplify kernel sanitizer interceptors
authorMark Johnston <markj@FreeBSD.org>
Mon, 19 Jul 2021 20:09:42 +0000 (16:09 -0400)
committerMark Johnston <markj@FreeBSD.org>
Fri, 30 Jul 2021 01:13:32 +0000 (21:13 -0400)
commita90d053b84223a4e5cb65852a9b6193570ab1c7d
treec5df8f2fecf5adc97c33c7d93a9e168c85d0a940
parent419d406e4ee068644218fb881bc80f79f8191970
Simplify kernel sanitizer interceptors

KASAN and KCSAN implement interceptors for various primitive operations
that are not instrumented by the compiler.  KMSAN requires them as well.
Rather than adding new cases for each sanitizer which requires
interceptors, implement the following protocol:
- When interceptor definitions are required, define
  SAN_NEEDS_INTERCEPTORS and SANITIZER_INTERCEPTOR_PREFIX.
- In headers that declare functions which need to be intercepted by a
  sanitizer runtime, use SANITIZER_INTERCEPTOR_PREFIX to provide
  declarations.
- When SAN_RUNTIME is defined, do not redefine the names of intercepted
  functions.  This is typically the case in files which implement
  sanitizer runtimes but is also needed in, for example, files which
  define ifunc selectors for intercepted operations.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
sys/amd64/amd64/copyout.c
sys/amd64/include/atomic.h
sys/arm64/include/bus.h
sys/conf/kern.pre.mk
sys/kern/subr_asan.c
sys/kern/subr_csan.c
sys/sys/atomic_san.h
sys/sys/bus_san.h
sys/sys/libkern.h
sys/sys/systm.h
sys/x86/include/bus.h