To use:
- Add options UBSAN to the kernel configuration file
- Add WITH_UBSAN=yes to src.conf(5) to enable UBSAN
- (optional) Add WITH_UBSAN_SANITIZE_ALL=yes to src.conf(5) to check all kernel source files for undefined behaviour
To check individual kernel source files with UBSAN, add compile-with "${NORMAL_C} ${ENABLE_UBSAN}" to the corresponding line in sys/conf/files. To disable UBSAN for individual files (even with WITH_UBSAN_SANITIZE_ALL=yes), add compile-with "${NORMAL_C} ${DISABLE_UBSAN}" to the corresponding line in sys/conf/files.