From owner-dev-commits-src-all@freebsd.org Mon Aug 2 13:35:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECE21674657; Mon, 2 Aug 2021 13:35:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GdfBk3ypxz4Rc8; Mon, 2 Aug 2021 13:35:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6490D20259; Mon, 2 Aug 2021 13:35:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 172DZA0t050651; Mon, 2 Aug 2021 13:35:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 172DZAKC050650; Mon, 2 Aug 2021 13:35:10 GMT (envelope-from git) Date: Mon, 2 Aug 2021 13:35:10 GMT Message-Id: <202108021335.172DZAKC050650@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: f0712132b68b - main - Don't instrument the rdtsc ifunc when building with ASAN/UBSAN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0712132b68b4271e0602b06ee5f282718bfb8c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 13:35:11 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=f0712132b68b4271e0602b06ee5f282718bfb8c5 commit f0712132b68b4271e0602b06ee5f282718bfb8c5 Author: Alex Richardson AuthorDate: 2021-08-02 08:51:01 +0000 Commit: Alex Richardson 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