From nobody Mon Oct 28 16:59:45 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xcfkp0v0zz5bXx7; Mon, 28 Oct 2024 16:59:46 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xcfkn5RyNz4DlF; Mon, 28 Oct 2024 16:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730134785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wqeuqgweu9Gq+HkBwC+ouzE7cK7Ko5leyykYIMWW7sU=; b=S6d4q+u0Be9OFxON+CGrB7kmwBhUbWaTpbbCcX4U7YAmobA3pRjyg9nJwaoOSRIAhzPbKh XIh2L8kfzaF4bSG1bWYT2SC1yQVy+iwOnVfn9gDhpeuSEB8totFAFNKqr61BfmWaeLgQgT KcgjuWYhL4YedKSNhVCPb37IIFXY/UCHQboPd7UrVAq2VjPRvOCnbWo6LkiSfHEX4RM0hb N25HzsgZxcZzv375o4zcQx/nzWjX7K9O8KTgisvWCRIEU/7QVmdBLa88gHq3HSVV3VjiCC XHPEa959e8BltrWw5GfVnPEtiDZzQwsC/O9H+9PNG8tTxzUHwg7oTiQ1YJOaLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730134785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wqeuqgweu9Gq+HkBwC+ouzE7cK7Ko5leyykYIMWW7sU=; b=xI9+LEgJYPAJb5Bqb3wm9mBE2hDzUFcBfxe3u/Vk91bTaBKawlVFTFHdTXgQXLpXutYhT2 v+4Xa/MATxLXpm0bukA4c0G+khq0mFbJhbJxc/U1OotcjXZE4AxZhTlWGjsMZJM8vbvamL SavLVitlyMBhOu2Cx2qdVYYUVWRAzWuTB3sdODEKF84ufa4pcdcNv58wCLztQG+4N8S/gY FYRV7FC7T1FXZDbmSe03A1S3VQRRkrUAteNBDLfO8v//Rk6v4DVGOOKw6/psPC9EWn1lu+ kIMc1Og6tjP6yxrRqpnwZeI5Pd7YJql5WM/H140UPo8Ze7DmOjYHzagj7NNupw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730134785; a=rsa-sha256; cv=none; b=ijQeLMEYp0LZNRLb6QJit4h9mmslmEhMI3PC80RS4WZkUIYS2/rCwiWhxmhSd33xUXeU1S Epfy+PYiKFlL+SJL5QDCDJ7oVZNePI9SZoEh4HyHkQe9cB0ySRE0fs0aNc7wcP4hAIVXBf K4xslybsdeU3bg9DkaoGO+G2trTv/Xz6l5hxKsWkvTt2O3s8LfMWDBUeOFSGCqbPR/BBQw YvcGIQ4DOB1kjOfYvKSNws9T7WKJEUaSQi/hwFq44FHR6fADKrYzKU4IcExaGizoGOPWGa I+Ac+wvoSDm61ApP2CbsKeNuuJHJz4aeW4NpJ3FDfpsxDdslOL89Xqjdkt3jAw== 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 4Xcfkn4kSbzmly; Mon, 28 Oct 2024 16:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49SGxjdb040041; Mon, 28 Oct 2024 16:59:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49SGxjUa040038; Mon, 28 Oct 2024 16:59:45 GMT (envelope-from git) Date: Mon, 28 Oct 2024 16:59:45 GMT Message-Id: <202410281659.49SGxjUa040038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b240f05f13c9 - stable/14 - cdefs: Use __has_feature to gate the definition of __nosanitize* List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b240f05f13c9e68fd48e716cd0d5fa2e77aefa11 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b240f05f13c9e68fd48e716cd0d5fa2e77aefa11 commit b240f05f13c9e68fd48e716cd0d5fa2e77aefa11 Author: Mark Johnston AuthorDate: 2024-10-19 13:55:12 +0000 Commit: Mark Johnston CommitDate: 2024-10-28 16:39:50 +0000 cdefs: Use __has_feature to gate the definition of __nosanitize* clang 12 does not implement the coverage sanitizer, and the build fails when __attribute__((no_sanitize("coverage"))) is used. Try to work around the problem by giving __nosanitize* a non-trivial definition only when the corresponding sanitizer is actually enabled in the build. Tested by reading disassembly of pmap_update_strided() and pmap_enter() in a kernel compiled with "options COVERAGE", and similar sanity checks for the other sanitizers. I also test-booted KASAN and KMSAN kernels in amd64 bhyve. Suggested by: jrtc27 Reviewed by: imp Fixes: a78bacf3b0ec ("cdefs: Add __nosanitizecoverage") MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47193 (cherry picked from commit 3dc6188294dd4f907f5f63cc3f1a79ea20dba99f) --- sys/sys/cdefs.h | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 4fa4decd7652..1481bc1d89d1 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -872,21 +872,33 @@ * GCC has the nosanitize attribute, but as a function attribute only, and * warns on use as a variable attribute. */ -#if __has_attribute(no_sanitize) && defined(__clang__) +#if __has_feature(address_sanitizer) && defined(__clang__) #ifdef _KERNEL -#define __nosanitizeaddress __attribute__((no_sanitize("kernel-address"))) -#define __nosanitizememory __attribute__((no_sanitize("kernel-memory"))) +#define __nosanitizeaddress __attribute__((no_sanitize("kernel-address"))) #else -#define __nosanitizeaddress __attribute__((no_sanitize("address"))) -#define __nosanitizememory __attribute__((no_sanitize("memory"))) +#define __nosanitizeaddress __attribute__((no_sanitize("address"))) #endif -#define __nosanitizecoverage __attribute__((no_sanitize("coverage"))) -#define __nosanitizethread __attribute__((no_sanitize("thread"))) #else -#define __nosanitizeaddress -#define __nosanitizecoverage -#define __nosanitizememory -#define __nosanitizethread +#define __nosanitizeaddress +#endif +#if __has_feature(coverage_sanitizer) && defined(__clang__) +#define __nosanitizecoverage __attribute__((no_sanitize("coverage"))) +#else +#define __nosanitizecoverage +#endif +#if __has_feature(memory_sanitizer) && defined(__clang__) +#ifdef _KERNEL +#define __nosanitizememory __attribute__((no_sanitize("kernel-memory"))) +#else +#define __nosanitizememory __attribute__((no_sanitize("memory"))) +#endif +#else +#define __nosanitizememory +#endif +#if __has_feature(thread_sanitizer) && defined(__clang__) +#define __nosanitizethread __attribute__((no_sanitize("thread"))) +#else +#define __nosanitizethread #endif /*