HomeFreeBSD

Simplify kernel sanitizer interceptors

Description

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

(cherry picked from commit a90d053b84223a4e5cb65852a9b6193570ab1c7d)

Details

Provenance
markjAuthored on Jul 19 2021, 8:09 PM
Parents
rGb46654104fcc: wg: Fix build without VIMAGE.
Branches
Unknown
Tags
Unknown