From nobody Fri Aug 7 01:48:05 2026 X-Original-To: dev-commits-src-branches@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 4hGRqp1BJbz6ndny for ; Fri, 07 Aug 2026 01:48:06 +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 4hGRqn4ylBz3p7N for ; Fri, 07 Aug 2026 01:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786067285; 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=s/pJKSbhvnJyT4dxcIc9X/m7/y0T2YnixxTh8qB0VX0=; b=ayNmhRlYVnQjMjS12PSa4Mld4aMCJU5yac3953+GkXxAdSsbEyvLFcny1bu+Ywc0fyPAlD XuVZ6EO1/fYgK7dbnjzZXc/LBj5nv9P4WSJ//p95vmI8M48lcxAmZ9ck5QHMlsX54oeX86 JS0QDLYQ4RRHFZE+H5z0rk/rjGfhZvlNbw54mq0taWbm25cHB/+LXY8wGRNEbjyHdjMb3v 1YEIUUKoSW1cL1hQz9fk2gTdcTackbVAnux/m4nTYSJkv+F1mvmIVDLYcAodg3PLTI78V3 JYEKtXZRXAHpIog8mxww2YcI/kAPgtnbhRpWfVDsEtnLDhVMQeWPrg8X2hr8yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786067285; a=rsa-sha256; cv=none; b=ZYE0cQZL8gJC+zRmBCUHJPNHewdgy2D6ScTKyzRd2A7/fCKzQ8Dw3qfgI07APeewTdivrV /NoycIEL+BAJrDcrSIlYYrRG78pnSnigGbGNjyDwU2NbnhEuaiB5gkF+JQdzL5jzFjBtgX 2GtFLseJaDhfRIVnLgOmeVsjuIceqOSl5iGUYybh2bvc1CB8knyBnFQY8UjiWoKVwQSVwQ jJRVvJsewHOceYOW2QKruk9zXUCPQWTy63ovB+DHxAfHhcPPZHthg+k9Pn31IQ9ZOCNSNZ vvfNw/iA7uDthu1FIi/FcfVP5ZMjW7MhbIe/FcO60JwVT81EkZvNihlHwdwj/Q== 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=1786067285; 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=s/pJKSbhvnJyT4dxcIc9X/m7/y0T2YnixxTh8qB0VX0=; b=bgYBDxLCUr/s7nSgHIFLP0Wffd2o4igBCBR36aSAYT1cJeRj+YRoPta1IakpblNM3+UcEH jC+photms1cBOdPK7rVYRuFg6VXDICoVsZnADLZYLfepxWHbugH8v+jLQn8oC5QfkuWXOE QYVSZj0dBbpCG7HtfRy6z+g5AkJs4aeRWCqxJQ9tRmb3AGMN4MJc2JsURuaZl4GPKhHDiW 0kQFi0WHYOcb2j/zxzNLcykojZwnldbvm/tU0tPUURXi0YurqE7vwTgcerWsmOmEksLtXr +J4QyVBYbI8IBC+Z2sdv14wufqXHSYwCvAYFuWArisWZGYOAK2m2Z1xAFtF9WA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hGRqn2w3DzmX2 for ; Fri, 07 Aug 2026 01:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ade3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 07 Aug 2026 01:48:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 690207d4efc1 - stable/15 - build: provide a FORTIFY_SOURCE. override List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/15 X-Git-Reftype: branch X-Git-Commit: 690207d4efc1560bf3fced49065c1ce621a2c67f Auto-Submitted: auto-generated Date: Fri, 07 Aug 2026 01:48:05 +0000 Message-Id: <6a753955.3ade3.7f94bea6@gitrepo.freebsd.org> The branch stable/15 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=690207d4efc1560bf3fced49065c1ce621a2c67f commit 690207d4efc1560bf3fced49065c1ce621a2c67f Author: Kyle Evans AuthorDate: 2026-06-17 22:40:46 +0000 Commit: Kyle Evans CommitDate: 2026-08-06 23:34:41 +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) (cherry picked from commit 13184a69faa700319ab16357cd39708a0e89fc15) --- 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 d58830ad48c7..ed04825f575f 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -306,9 +306,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} @@ -318,9 +315,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