aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2021-08-02 08:51:01 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-08-02 13:33:24 +0000
commitf0712132b68b4271e0602b06ee5f282718bfb8c5 (patch)
tree95f9e1d0b151d660e25cbd4f8e48d0ba591f2d95
parent5e9226f063bc43574e2168b4aafad8232f08002a (diff)
downloadsrc-f0712132b68b4271e0602b06ee5f282718bfb8c5.tar.gz
src-f0712132b68b4271e0602b06ee5f282718bfb8c5.zip
Don't instrument the rdtsc ifunc when building with ASAN/UBSAN
The ifunc resolver is called before the sanitizer runtime is initialized, so any instrumentation results in an immediate crash. Reviewed By: kib Differential Revision: https://reviews.freebsd.org/D31046
-rw-r--r--lib/libc/x86/sys/Makefile.inc8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc/x86/sys/Makefile.inc b/lib/libc/x86/sys/Makefile.inc
index 41e0d1a8ad66..eff3a1085ec6 100644
--- a/lib/libc/x86/sys/Makefile.inc
+++ b/lib/libc/x86/sys/Makefile.inc
@@ -12,3 +12,11 @@ MAN+= \
.if ${MACHINE_CPUARCH} == "amd64" && ${MK_HYPERV} != "no"
CFLAGS+= -DWANT_HYPERV
.endif
+# We can't use sanitizer instrumentation on ifuncs called during sanitizer
+# runtime startup.
+.if ${MK_ASAN} != "no"
+CFLAGS.__vdso_gettc.c+=-fno-sanitize=address
+.endif
+.if ${MK_UBSAN} != "no"
+CFLAGS.__vdso_gettc.c+=-fno-sanitize=undefined
+.endif