git: f0712132b68b - main - Don't instrument the rdtsc ifunc when building with ASAN/UBSAN

Alex Richardson arichardson at FreeBSD.org
Mon Aug 2 13:35:11 UTC 2021


The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=f0712132b68b4271e0602b06ee5f282718bfb8c5

commit f0712132b68b4271e0602b06ee5f282718bfb8c5
Author:     Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-08-02 08:51:01 +0000
Commit:     Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-08-02 13:33:24 +0000

    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
---
 lib/libc/x86/sys/Makefile.inc | 8 ++++++++
 1 file changed, 8 insertions(+)

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


More information about the dev-commits-src-main mailing list