aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/string/Makefile.inc9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc
index 6945155812af..1df3d40e329f 100644
--- a/lib/libc/string/Makefile.inc
+++ b/lib/libc/string/Makefile.inc
@@ -29,6 +29,15 @@ MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \
SYM_MAPS+= ${LIBC_SRCTOP}/string/Symbol.map
+.if ${MK_ASAN} != "no"
+# These source files deliberately read out of bounds since they assume that
+# out-of-bounds memory accesses that don't cross pages are always legal.
+# Note: While this is fine on x86, it does break when running with CHERI.
+CFLAGS.strlen.c+= -fno-sanitize=address
+CFLAGS.strchrnul.c+= -fno-sanitize=address
+CFLAGS.memchr.c+= -fno-sanitize=address
+.endif
+
# machine-dependent string sources
.sinclude "${LIBC_SRCTOP}/${LIBC_ARCH}/string/Makefile.inc"