From nobody Wed Jun 17 22:40:54 2026 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 4ggf2z6lCvz6hvWC for ; Wed, 17 Jun 2026 22:40:59 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ggf2z5dfPz4JqP for ; Wed, 17 Jun 2026 22:40:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781736059; 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=5KkUyLktgG5/o3mmXH16oBrRKv5xiMtvFy2fBS8HAH4=; b=YX5n98QBNY9G+IgflYB9Cg7GgnE1EDNRymw49EoDc7FuoNpstPXal/AkOSKAeukw6daBsz lfVfJYhfKJD81bOeF/nE0I5HTUs2kHVsdoconYT/tCry1XlNLpeXBAWNq2QLfgOAnAL6sU 8Gn/p2oQ9AVr+6/ofYmyhBrVh/EZpxL2AM23nibU2pcFlkGq8llmXRtIob+Tuk2ZG+Cocv zY7I5b0Q+ECx8wMo1dZIOzieBMpZg+JNikELC92rrxJ2z3qWJqK+9cxMrvzqVN/bDd1h7I 4ZlBMliTU/96Pxilv+uuukVrGbOdBH+ckukpopGIFDk3MPI/kJDCKpWyLbMChQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781736059; a=rsa-sha256; cv=none; b=NQK6IRHysJsuPHRMTBt8BTXsbZY2wGDJVSh3OiiQSUgQy88LBKIfkQc1Vj3M9X5sXt0I5L F9QX+MuttNIoW/2wDRCj/SvJaRxKKT+8XxPPoAVqZccRfKSMyi/2YAuMyiGMAeg3Fik2IK wntgtJILBjuFwjciBgZ7/jpFqaxOW1BwXza1QmhCML3kr/5OZLMrTBvsbGA48JVl5d3q+Y tEIpSZwBXvB0VW4ZUp5+pXJnp1/Mgmu+96UA62wztcqWQA1PcrikEgUpktPVCBI09Pt5Ul oVCwKbb6Mu+0pQ62XiKWe7pFtjc6r7h2kvflMXvK0fc+gm0Tihh9k+LHASeoSA== 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=1781736059; 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=5KkUyLktgG5/o3mmXH16oBrRKv5xiMtvFy2fBS8HAH4=; b=AnfwF+Kqq+BFhoI2kknPwSzfFZMKmpNAyIFHeViHTueLUmnwJ+jQhnGxqI1jr9ZaUpKcLd Mn+Ohiplzy5DNsPtGvJwydKy04KsZABC9leYPz7s5jGjFyD3BkbPsZJa/i9QzNff5/dZZx xLyfsDnzXpkN7Fb4rLne0vsfBLPH35GPmR6O2/ayx1rOQz40oZJ+MBUhS//HP6tFuYzNiD a1Lzmor+R/cYQFD58nMLgiU+ea81z9WulOFdwnRkE/ZHPEtxPIivzMUbPLabUAcHOp2V9e 2+T4TowCGoHOfMNwXgIKYxyX9PTkKzmgvTaoHxM49tuh3VbJEzPs3/HsX+MhHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4ggf2z4CzFzXYY for ; Wed, 17 Jun 2026 22:40:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4778c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 17 Jun 2026 22:40:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 13184a69faa7 - main - build: provide a FORTIFY_SOURCE. override 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13184a69faa700319ab16357cd39708a0e89fc15 Auto-Submitted: auto-generated Date: Wed, 17 Jun 2026 22:40:54 +0000 Message-Id: <6a332276.4778c.72ea74c8@gitrepo.freebsd.org> The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=13184a69faa700319ab16357cd39708a0e89fc15 commit 13184a69faa700319ab16357cd39708a0e89fc15 Author: Kyle Evans AuthorDate: 2026-06-17 22:40:46 +0000 Commit: Kyle Evans CommitDate: 2026-06-17 22:40:46 +0000 build: provide a FORTIFY_SOURCE. override For native files we can do more minimal fixes to avoid this large of a hammer, but for third party files it may not be worth the effort to try and patch them. NetBSD has the original _FORTIFY_SOURCE implementation that ours is based on, for instance, but tests sourced from there can't do an __ssp_real(foo) without being certain that `foo` actually has a fortified definition. This change does always define _FORTIFY_SOURCE as a result, so gate it on CFLAGS not already containing _FORTIFY_SOURCE definitions. This re-applies c46a0b59071614, but without re-defining _FORTIFY_SOURCE needlessly. PR: 294881 Reviewed by: markj, sjg (both previous version) Differential Revision: https://reviews.freebsd.org/D57356 --- share/mk/bsd.sys.mk | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 4ffac401eb4c..139cb8bec843 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -307,9 +307,6 @@ CLANG_OPT_SMALL+= -mllvm -simplifycfg-dup-ret CLANG_OPT_SMALL+= -mllvm -enable-load-pre=false CFLAGS.clang+= -Qunused-arguments -# XXX This should be defaulted to 2 when WITH_SSP is in use after further -# testing and soak time. -FORTIFY_SOURCE?= 0 .if ${MK_SSP} != "no" # Don't use -Wstack-protector as it breaks world with -Werror. .if ${COMPILER_FEATURES:Mstackclash} @@ -319,9 +316,19 @@ SSP_CFLAGS?= -fstack-protector-strong .endif CFLAGS+= ${SSP_CFLAGS} .endif # SSP -.if ${FORTIFY_SOURCE} > 0 -CFLAGS+= -D_FORTIFY_SOURCE=${FORTIFY_SOURCE} -CXXFLAGS+= -D_FORTIFY_SOURCE=${FORTIFY_SOURCE} + +# XXX This should be defaulted to 2 when WITH_SSP is in use after further +# testing and soak time. +FORTIFY_SOURCE?= 0 + +# We want to avoid defining _FORTIFY_SOURCE if it's set to 0, but we rely on +# deferred-evaluation for ${.IMPSRC} to expand. The below construction +# is, unfortunately, necessary. +.if empty(CFLAGS:M-D_FORTIFY_SOURCE*) +CFLAGS+= ${FORTIFY_SOURCE.${.IMPSRC:T}:U${FORTIFY_SOURCE}:S/^/-D_FORTIFY_SOURCE=/:N*=0} +.endif +.if empty(CXXFLAGS:M-D_FORTIFY_SOURCE*) +CXXFLAGS+= ${FORTIFY_SOURCE.${.IMPSRC:T}:U${FORTIFY_SOURCE}:S/^/-D_FORTIFY_SOURCE=/:N*=0} .endif # Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is