From nobody Fri Sep 01 16:54:57 2023 X-Original-To: dev-commits-src-main@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 4RckfV1Sfcz4rlhk; Fri, 1 Sep 2023 16:54:58 +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 4RckfV11VTz3VJN; Fri, 1 Sep 2023 16:54:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693587298; 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=ZvDEsk/5PHuOaLuNyzYy8UxQ/7m/nB/6oa4SxYYW99U=; b=g4oCBiYQ/Ke2yRzxOsqFVlYLIp4fmJsOir8ZG3nyKwvTlus0G0yhulKBW9rt5XIHleDp0t 8JqXAcO9N+/wPQhe96HFRL+6Kh8nXP2AjTYPeZ0/gQkHhMw8VCLBnvsskqBCDGwr4CLeVS dNWdCCyn7PGy997SP01uqNssExeD16CE/0Dp1jo/JvfGSMJx2FZM1vjY8CgKNuhf59Bz9n knSRU/Kr9lHqN3gWDpqTi7KetMh4gdOF4PUyBNXlZj+vSDZej5k7MYfo5O/txR9gcRCuAn yo3ZRJiefnXpZRCiY7O6c0H4N3a/42a0DSfeFskdoQyYNgoztjcOXvA/eGbE+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693587298; a=rsa-sha256; cv=none; b=Y53hL3KaTgxrqZuQSR90mNMVjyeJToeUKHN6wFuRBLsyIUMdt/uEaA2HPPk2Kv29ffLh1G B6djJJG0/PHEb3FStXx7d/QP5IQLAuuavdUzWhiYiGw5/y8wh2dfMgjCgnTGGql+/fXYVj 7Be4FXyBYHgWnQKYnFlnXiqc36sniNg8SJ+jCKY1WnvWmKWZVD9IORJT4wLprMDJShDFlo ij5U2oUI8IujqsVowdWv+9JaTA1pWqVRgnPOqLLHFAUVPzJoBgTVTzDOLb1Yxlaruxx6Fh niTA+5MS0MmyJi4vcDw8KCeXPOrf0UDMq7f3FWRFo3gxnuNP61YMgys5joYaBA== 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=1693587298; 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=ZvDEsk/5PHuOaLuNyzYy8UxQ/7m/nB/6oa4SxYYW99U=; b=AMRKxBjWkfLWZM/eGO9ZiWbWkG9rFbFH8Sv9y3p05dDDaFsIhSFfd08eVls+swNpb8Haw6 xbasWR5HMdJRkPKdRdJ98NXLj+7yR/EAos3dXRNMBobKNDPSQI3wFBO4teQzuIoXsNJ5LM uPbjS/eOu85/+KDyd4DxYPUabUddZS1rfCI2D+X+uc0EfJMNwAk7JuEJIfHLh4NkOtHthW 6P8xi9tQZoR7ppfXK+r4cyDcxyplsfj4nmBYT+WSl1LijZEMcQVTBlaQP1LDgyxsfuHKxc rTa3ibx4/88o0Sk3B7dHBRlurTF8eIw6rvw5P2rzLw8xc0cNVwEWPD3U/Xy3Yg== 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 4RckfT6m98z17p1; Fri, 1 Sep 2023 16:54:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 381Gsv2B070765; Fri, 1 Sep 2023 16:54:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 381GsvXg070762; Fri, 1 Sep 2023 16:54:57 GMT (envelope-from git) Date: Fri, 1 Sep 2023 16:54:57 GMT Message-Id: <202309011654.381GsvXg070762@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 2befa269b869 - main - Add INIT_ALL build option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2befa269b869c810b4436b7b5fe922ac3278ee5e Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=2befa269b869c810b4436b7b5fe922ac3278ee5e commit 2befa269b869c810b4436b7b5fe922ac3278ee5e Author: Brooks Davis AuthorDate: 2023-09-01 16:42:52 +0000 Commit: Brooks Davis CommitDate: 2023-09-01 16:54:24 +0000 Add INIT_ALL build option This option replaces WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO with INIT_ALL=pattern and INIT_ALL=zero respectively. As these are relatively rarely used options no backwards compatibility is implemented. Reviewed by: emaste Relnotes: yes Differential Revision: https://reviews.freebsd.org/D41675 --- UPDATING | 4 ++++ share/mk/bsd.lib.mk | 17 +++++------------ share/mk/bsd.opts.mk | 12 ++++++------ share/mk/bsd.prog.mk | 17 +++++------------ sys/conf/kern.mk | 14 ++++---------- sys/conf/kern.opts.mk | 18 ++++++++++-------- tools/build/options/INIT_ALL | 21 +++++++++++++++++++++ tools/build/options/WITH_INIT_ALL_PATTERN | 4 ---- tools/build/options/WITH_INIT_ALL_ZERO | 3 --- 9 files changed, 55 insertions(+), 55 deletions(-) diff --git a/UPDATING b/UPDATING index fbb899cc25a4..0b1d8aeb60c5 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20230901: + The WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO build option have + been replaced by INIT_ALL=pattern and INIT_ALL=zero respectively. + 20230824: FreeBSD 15.0-CURRENT. diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 3099c8e205b1..90d89eeebc5d 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -101,23 +101,16 @@ LDFLAGS+= -Wl,-zretpolineplt LDFLAGS.bfd+= -Wl,-znoexecstack # Initialize stack variables on function entry -.if ${MK_INIT_ALL_ZERO} == "yes" +.if ${OPT_INIT_ALL} != "none" .if ${COMPILER_FEATURES:Minit-all} -CFLAGS+= -ftrivial-auto-var-init=zero -CXXFLAGS+= -ftrivial-auto-var-init=zero -.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 +CFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} +CXXFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} +.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang CXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang .endif .else -.warning InitAll (zeros) requested but not supported by compiler -.endif -.elif ${MK_INIT_ALL_PATTERN} == "yes" -.if ${COMPILER_FEATURES:Minit-all} -CFLAGS+= -ftrivial-auto-var-init=pattern -CXXFLAGS+= -ftrivial-auto-var-init=pattern -.else -.warning InitAll (pattern) requested but not supported by compiler +.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler .endif .endif diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index bb9fba38e5a6..93b0e7184b6d 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -75,8 +75,6 @@ __DEFAULT_NO_OPTIONS = \ BIND_NOW \ CCACHE_BUILD \ CTF \ - INIT_ALL_PATTERN \ - INIT_ALL_ZERO \ INSTALL_AS_USER \ MANSPLITPKG \ PROFILE \ @@ -103,14 +101,16 @@ __DEFAULT_NO_OPTIONS+= PIE __DEFAULT_YES_OPTIONS+=PIE .endif +__SINGLE_OPTIONS = \ + INIT_ALL + +__INIT_ALL_OPTIONS= none pattern zero +__INIT_ALL_DEFAULT= none + .-include .include -.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes" -.warning WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive. -.endif - # # Supported NO_* options (if defined, MK_* will be forced to "no", # regardless of user's setting). diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 8c3ba69af73d..c546c4f0b680 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -71,23 +71,16 @@ LDFLAGS+= -Wl,-zretpolineplt LDFLAGS.bfd+= -Wl,-znoexecstack # Initialize stack variables on function entry -.if ${MK_INIT_ALL_ZERO} == "yes" +.if ${OPT_INIT_ALL} != "none" .if ${COMPILER_FEATURES:Minit-all} -CFLAGS+= -ftrivial-auto-var-init=zero -CXXFLAGS+= -ftrivial-auto-var-init=zero -.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 +CFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} +CXXFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} +.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang CXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang .endif .else -.warning InitAll (zeros) requested but not supported by compiler -.endif -.elif ${MK_INIT_ALL_PATTERN} == "yes" -.if ${COMPILER_FEATURES:Minit-all} -CFLAGS+= -ftrivial-auto-var-init=pattern -CXXFLAGS+= -ftrivial-auto-var-init=pattern -.else -.warning InitAll (pattern) requested but not supported by compiler +.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler .endif .endif diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index dcaacbf831cb..e00e025ab91b 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -242,20 +242,14 @@ CFLAGS+= -mretpoline # # Initialize stack variables on function entry # -.if ${MK_INIT_ALL_ZERO} == "yes" +.if ${OPT_INIT_ALL} != "none" .if ${COMPILER_FEATURES:Minit-all} -CFLAGS+= -ftrivial-auto-var-init=zero -.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 +CFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} +.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang .endif .else -.warning InitAll (zeros) requested but not supported by compiler -.endif -.elif ${MK_INIT_ALL_PATTERN} == "yes" -.if ${COMPILER_FEATURES:Minit-all} -CFLAGS+= -ftrivial-auto-var-init=pattern -.else -.warning InitAll (pattern) requested but not support by compiler +.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler .endif .endif diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index bad5e218a5b0..f908f761b21e 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -57,8 +57,6 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ BHYVE_SNAPSHOT \ EXTRA_TCP_STACKS \ - INIT_ALL_PATTERN \ - INIT_ALL_ZERO \ KERNEL_RETPOLINE \ RATELIMIT \ REPRODUCIBLE_BUILD \ @@ -72,12 +70,6 @@ __DEFAULT_NO_OPTIONS = \ # Kernel config files are unaffected, though some targets can be # affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP. -# Things that don't work based on the CPU -.if ${MACHINE} == "amd64" -# PR251083 conflict between INIT_ALL_ZERO and ifunc memset -BROKEN_OPTIONS+= INIT_ALL_ZERO -.endif - # Broken on 32-bit arm, kernel module compile errors .if ${MACHINE_CPUARCH} == "arm" BROKEN_OPTIONS+= OFED @@ -99,6 +91,16 @@ __DEFAULT_NO_OPTIONS += FDT __DEFAULT_YES_OPTIONS += FDT .endif +__SINGLE_OPTIONS = \ + INIT_ALL + +__INIT_ALL_OPTIONS= none pattern zero +__INIT_ALL_DEFAULT= none +.if ${MACHINE} == "amd64" +# PR251083 conflict between INIT_ALL_ZERO and ifunc memset +BROKEN_SINGLE_OPTIONS+= INIT_ALL zero none +.endif + # expanded inline from bsd.mkopt.mk to avoid share/mk dependency # Those that default to yes diff --git a/tools/build/options/INIT_ALL b/tools/build/options/INIT_ALL new file mode 100644 index 000000000000..3ca70337b8f1 --- /dev/null +++ b/tools/build/options/INIT_ALL @@ -0,0 +1,21 @@ +Control default initialization of stack variables in C and C++ code. +Options other than +.Li none +require the Clang compiler or GCC 12.0 or later. +The default value is +.Li none . +Valid values are: +.Bl -tag -width indent +.It Li none +Do not initialize stack variables (standard C/C++ behavior). +.It Li pattern +Build the base system or kernel with stack variables initialized to +.Pq compiler defined +debugging patterns on function entry. +.It Li zero +Build the base system or kernel with stack variables initialized +to zero on function entry. +This value is converted to +.Li none +for amd64 kernel builds due to incompatability with ifunc memset. +.El diff --git a/tools/build/options/WITH_INIT_ALL_PATTERN b/tools/build/options/WITH_INIT_ALL_PATTERN deleted file mode 100644 index 781c0ea19ab6..000000000000 --- a/tools/build/options/WITH_INIT_ALL_PATTERN +++ /dev/null @@ -1,4 +0,0 @@ -Build the base system or kernel with stack variables initialized to -.Pq compiler defined -debugging patterns on function entry. -This option requires the clang compiler. diff --git a/tools/build/options/WITH_INIT_ALL_ZERO b/tools/build/options/WITH_INIT_ALL_ZERO deleted file mode 100644 index 102462316759..000000000000 --- a/tools/build/options/WITH_INIT_ALL_ZERO +++ /dev/null @@ -1,3 +0,0 @@ -Build the base system or kernel with stack variables initialized -to zero on function entry. -This option requires that the clang compiler be used.