FreeBSD: Make it possible to build openzfs.ko with sanitizers

Add make options which let one respectively compile the kernel modules
with the address sanitizer, memory sanitizer, and undefined behaviour
sanitizer enabled.  This makes it much easier to run the ZTS with those
sanitizers enabled.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Chris Longros <chris.longros@gmail.com>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #18596
This commit is contained in:
Mark Johnston
2026-05-28 12:02:48 -04:00
committed by GitHub
parent dc585960e0
commit e30ab5fa4f
+6
View File
@@ -65,6 +65,12 @@ CFLAGS+= -DZFS_DEBUG -g
CFLAGS += -DNDEBUG CFLAGS += -DNDEBUG
.endif .endif
.for _SAN in KASAN KMSAN KUBSAN
.if defined(WITH_${_SAN}) && ${WITH_${_SAN}} == "true"
KERN_OPTS_EXTRA+= ${_SAN}
.endif
.endfor
.if defined(WITH_GCOV) && ${WITH_GCOV} == "true" .if defined(WITH_GCOV) && ${WITH_GCOV} == "true"
CFLAGS+= -fprofile-arcs -ftest-coverage CFLAGS+= -fprofile-arcs -ftest-coverage
.endif .endif