From nobody Fri Aug 30 16:03:52 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 4WwNHY1j7Zz5Mp9R; Fri, 30 Aug 2024 16:03:53 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WwNHY14Pwz4BLK; Fri, 30 Aug 2024 16:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725033833; 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=h6jT3QAZEeMl1IepwmQIffB0hmH/3vSTPuHVwGZfDKQ=; b=g6kSslvMbzszh3g1uxOy9d4WCSMHH1WrRZBuPFtYPtolFrhM+de/tVPEB4bz51l0AWqyVb 48Ogty5+LkJnw0m5Uy5YVQk0QOcILtqcdfg4lGhI+JiNr+K6T9asDUcdEpPD7Lf+kdUnp7 IL0cT2Ym98dyP6dAqx8p4vhIJyFFXAIzj4SyTA23xkQTjAAhrl8B54AixQvFuTYbMSipB6 6Rz5obcUb9YtwFVSkaJ3Rk0hN71SFpVoB9mw+FgVb2eJoIpiC5sum6BHZRQwfpPegAmvTB bf2jcGhCeWHDHtSNMdTdmlEIepyHKa7PqYXiPBlOm6T9zyxTI5UPs9jlTaZoYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725033833; a=rsa-sha256; cv=none; b=xn/JDtMpszLPr2+vzuLWyrGMqVIZCVv11RYt03kaPS1Phya4wDdXLb3L4yuiUwmP9VJDos PK/qVtV97IduHoR8ipxxWWgZ9lFCfqsUVxoIcfgtPBfsEQtmogTuERT0qnOH/lH/0ppA/r Pqw2T6/6jES9AOyZYchgKlKbvC8sEmZ1AUzMpYJGyt7fuhB9Pd5PF9ccUmHop6WBDpZ2jn Ho1pwfKBBN+d/uvMiv6bqiYl8ZRqmu9DN4yUubc8FontAiBtKrUCdsFGOt6ZXdm0/yet4S aE8RRq6gEsIc+Hgmd64unNEIf8eBjarNaSUgCAV2H8//94/8ayN/HdZnphZvMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725033833; 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=h6jT3QAZEeMl1IepwmQIffB0hmH/3vSTPuHVwGZfDKQ=; b=c3ArKXxfJLYeaWSSWV01mRPgzVcbmIMZsqHJQW2poxG/zAYm9wQz4zhKidHSK0wbZC7/YZ D4whpEF56nAy0+mzOn0Le2P5KJain4AOjuBxmfoMH8ZX8t1y2hTWwzStyrHj/YMbn80pEO F6Vj7d3io1oBUP3jI6dBaA2T0v/DX1bFj631K/J4GFXOAfseUfZw1ctFxZvKh825FX04i3 NvB/2aOFmQfmRYNQ1YmB9DLm15VVHDoqD6Nt5lUUAdOHXtV0R2PukXobyvsmad2j/f8OZm tgV2SEbgVAuZbZNiXcRfnkjicWXfgOrsIeUih+0gd7T4jgCGO4wJsC9zxPkhAQ== 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 4WwNHY0gRrz16PY; Fri, 30 Aug 2024 16:03:53 +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 47UG3qc0026499; Fri, 30 Aug 2024 16:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47UG3quf026496; Fri, 30 Aug 2024 16:03:52 GMT (envelope-from git) Date: Fri, 30 Aug 2024 16:03:52 GMT Message-Id: <202408301603.47UG3quf026496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 973bbdab4703 - main - mk: Add a BTI-report linker feature 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 973bbdab47035ebd16200c63d095904924dc44d9 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=973bbdab47035ebd16200c63d095904924dc44d9 commit 973bbdab47035ebd16200c63d095904924dc44d9 Author: Jose Luis Duran AuthorDate: 2024-08-22 03:23:59 +0000 Commit: Andrew Turner CommitDate: 2024-08-30 16:03:17 +0000 mk: Add a BTI-report linker feature Add support for specifying how to report the missing Branch Target Identification (BTI) linker feature on AArch64. For: Kernel: bti-report on when the linker supports it Userspace: bti-report on when the linker supports it and BTI_REPORT_ERROR is defined Fixes: 43e8849bc294 ("conf: Enable BTI checking in the arm64 kernel") Pull Request: https://github.com/freebsd/freebsd-src/pull/1393 --- share/mk/bsd.lib.mk | 2 +- share/mk/bsd.linker.mk | 11 ++++++++--- share/mk/bsd.prog.mk | 2 +- sys/conf/kern.mk | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 575b521bea55..6e288b9cd4ce 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -99,7 +99,7 @@ LDFLAGS+= -Wl,-zretpolineplt LDFLAGS.bfd+= -Wl,-znoexecstack .if ${MK_BRANCH_PROTECTION} != "no" CFLAGS+= -mbranch-protection=standard -.if ${MACHINE_ARCH} == "aarch64" && defined(BTI_REPORT_ERROR) +.if ${LINKER_FEATURES:Mbti-report} && defined(BTI_REPORT_ERROR) LDFLAGS+= -Wl,-zbti-report=error .endif .endif diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk index 0e9477284ea3..cceeadd05b94 100644 --- a/share/mk/bsd.linker.mk +++ b/share/mk/bsd.linker.mk @@ -11,9 +11,11 @@ # LINKER_FEATURES may contain one or more of the following, based on # linker support for that feature: # -# - build-id: support for generating a Build-ID note -# - retpoline: support for generating PLT with retpoline speculative -# execution vulnerability mitigation +# - build-id: support for generating a Build-ID note +# - retpoline: support for generating PLT with retpoline speculative +# execution vulnerability mitigation +# - bti-report: support for specifying how to report the missing +# Branch Target Identification (BTI) property (AArch64) # # LINKER_FREEBSD_VERSION is the linker's internal source version. # @@ -112,6 +114,9 @@ ${X_}LINKER_FEATURES+= retpoline .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 90000 ${X_}LINKER_FEATURES+= ifunc-noplt .endif +.if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 140000 +${X_}LINKER_FEATURES+= bti-report +.endif .endif .else # Use LD's values diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 74a653057bda..89534b21d0e7 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -71,7 +71,7 @@ LDFLAGS+= -Wl,-zretpolineplt LDFLAGS.bfd+= -Wl,-znoexecstack .if ${MK_BRANCH_PROTECTION} != "no" CFLAGS+= -mbranch-protection=standard -.if ${MACHINE_ARCH} == "aarch64" && defined(BTI_REPORT_ERROR) +.if ${LINKER_FEATURES:Mbti-report} && defined(BTI_REPORT_ERROR) LDFLAGS+= -Wl,-zbti-report=error .endif .endif diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 079bd1173fad..00492584921b 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -143,7 +143,7 @@ CFLAGS += -mgeneral-regs-only CFLAGS += -ffixed-x18 # Build with BTI+PAC CFLAGS += -mbranch-protection=standard -.if ${LINKER_TYPE} == "lld" +.if ${LINKER_FEATURES:Mbti-report} LDFLAGS += -Wl,-zbti-report=error .endif # TODO: support outline atomics