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
This commit is contained in:
Alex Richardson 2021-08-02 09:51:01 +01:00
parent 5e9226f063
commit f0712132b6

View File

@ -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