KERNEL_SANITIZERS(7) | Miscellaneous Information Manual | KERNEL_SANITIZERS(7) |
kernel_sanitizers
—
NetBSD Kernel Sanitizers
Kernel Sanitizers are powerful kernel bug detection features that can automatically discover several classes of bugs at run time while the kernel executes.
NetBSD supports four kernel sanitizers. They are not mutually compatible, and only one can be enabled at a time, via compilation options.
Kernel Undefined Behavior Sanitizer, specializes in finding several types of undefined behaviors, such a misaligned accesses and integer overflows.
Heavy runtime checks.
Compiler instrumentation and an entirely MI runtime.
aarch64 (gcc), amd64 (gcc), arm (gcc). [Theoretically supported on all other architectures with no MD change required]
Kernel Address Sanitizer, specializes in finding memory corruptions such as buffer overflows and use-after-frees.
Heavy runtime checks, and ~12.5% increase in memory consumption.
Shadow memory, compiler instrumentation, special kernel wrappers, and light MD infrastructure.
aarch64 (gcc), amd64 (gcc, llvm), arm (gcc).
KASAN is made of six sub-features that perform memory validation:
+-----------------------------------------------------+ | SUPPORTED SUB-FEATURE | +---------+------+-------+---------+-----------+---------+------+ | PORT | HEAP | STACK | ATOMICS | BUS_SPACE | BUS_DMA | VLAs | +---------+------+-------+---------+-----------+---------+------+ | amd64 | Yes | Yes | Yes | Yes | Yes | Yes | +---------+------+-------+---------+-----------+---------+------+ | aarch64 | Yes | Yes | Yes | No | Yes | Yes | +---------+------+-------+---------+-----------+---------+------+ | arm | Yes | Yes | Yes | No | Yes | Yes | +---------+------+-------+---------+-----------+---------+------+
An architecture is allowed to have only partial support.
Each new port of KASAN should respect the existing naming conventions, and should introduce only one MD header file.
Kernel Concurrency Sanitizer, specializes in finding memory races.
Medium runtime checks.
Compiler instrumentation, special kernel wrappers, and light MD infrastructure.
amd64 (gcc).
Each new port of KCSAN should respect the existing naming conventions, and should introduce only one MD header file.
Kernel Memory Sanitizer, specializes in finding uninitialized memory.
Heavy runtime checks, and ~200% increase in memory consumption.
Double shadow memory, compiler instrumentation, special kernel wrappers, and heavy MD infrastructure.
amd64 (llvm).
Each new port of KMSAN should respect the existing naming conventions, and should introduce only one MD header file.
Support for KUBSAN was developed by Kamil Rytarowski. Support for KASAN, KCSAN and KMSAN was developed by Maxime Villard. Support for KASAN on ARM was developed by Nick Hudson.
July 12, 2020 | NetBSD 10.99 |