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 <[email protected]>
Reviewed-by: Chris Longros <[email protected]>
Signed-off-by: Mark Johnston <[email protected]>
Closes #18596
This commit is contained in:
Mark Johnston authored and GitHub committed 2026-05-28 09:02:48 -07:00
1 parent dc585960e0
commit e30ab5fa4f
1 file changed
+6
+6
View File
@@ -65,6 +65,12 @@ CFLAGS+= -DZFS_DEBUG -g
CFLAGS += -DNDEBUG
.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"
CFLAGS+= -fprofile-arcs -ftest-coverage
.endif