Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Aug 2021 13:35:10 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f0712132b68b - main - Don't instrument the rdtsc ifunc when building with ASAN/UBSAN
Message-ID:  <202108021335.172DZAKC050650@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson:

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

commit f0712132b68b4271e0602b06ee5f282718bfb8c5
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-08-02 08:51:01 +0000
Commit:     Alex Richardson <arichardson@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108021335.172DZAKC050650>