From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/files/, sys-apps/systemd/
Date: Tue, 24 May 2022 22:35:58 +0000 (UTC) [thread overview]
Message-ID: <1653431750.eb84c4b6a972b074bc60f64d3348e93602795df1.sam@gentoo> (raw)
commit: eb84c4b6a972b074bc60f64d3348e93602795df1
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue May 24 22:27:45 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 24 22:35:50 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb84c4b6
sys-apps/systemd: add 251.1
- Revert FORTIFY_SOURCE=3 patch for now as it breaks Clang (even without
setting F_S=3, or seemingly F_S at all, as we don't patch Clang to add that
in the way we do with GCC)
- Turn off F_S=3 accordingly given we've had to revert the patch which
fixes support for it.
Bug: https://bugs.gentoo.org/841770
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/systemd/Manifest | 1 +
.../files/251-revert-fortify-source-3-fix.patch | 40 ++++++++++++++++++++++
.../{systemd-9999.ebuild => systemd-251.1.ebuild} | 21 +++++++++++-
sys-apps/systemd/systemd-9999.ebuild | 20 ++++++++++-
4 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/sys-apps/systemd/Manifest b/sys-apps/systemd/Manifest
index 9b589c708f7e..a12a4d846fc0 100644
--- a/sys-apps/systemd/Manifest
+++ b/sys-apps/systemd/Manifest
@@ -1,3 +1,4 @@
DIST systemd-251.tar.gz 11431104 BLAKE2B da783d815adf244defc3c1ec8a788fffdff45215f5c2449c457e872ad89b8270caa3e48ecb696fa79eb1d79578ded3d098802fed0fc69a191ba2d7d6b120e068 SHA512 5a7116cfd99f7875334a1ce55a76ba1840a28b6500b02de82b879629768e10457efd8278024aa1ffefd43defe657284c4d51ab502ed3c7e6b63d5b6e0cc1f642
DIST systemd-stable-250.4.tar.gz 11132786 BLAKE2B 8fdfe1bad76e572dc1be0955f3d1c4080f2beb81a2f9670f80827899f5406ab8ed8675400c2f5e8ccef44cf1bceff42ceae12a42e1b67d46c0deb523e6495f25 SHA512 307ed0920da660b6c45d909fea66864fb98db8b2f6905d629fb2012fc4bf64dd25fd61168c22bf4098200be541be9b0e815fbde98806a99c85cb33d49d8b63d0
DIST systemd-stable-250.5.tar.gz 11212059 BLAKE2B b7dbcb9e82c51e966db20a92ccd59ac19309702c481dd575c4e6367ca5ade10fe4b689925416ce1169682380cbf22d7d692b2378ef091f3007c16891992e3f92 SHA512 ad864b67bd5e2f5fd5705b636467827e4735142cefba150d24bb8e51ac0263650b2b0e53d4426eb509d1db59b83dc3b4c4bf157cc355fc2b7524db6bc4a9b5cd
+DIST systemd-stable-251.1.tar.gz 11431880 BLAKE2B 0442489242b2fbfb316f207c7c8c718322a1ea2af8176378fb39bea441fdd8bbb36ea840af9bdec257b714f5f3099daa1139bc6df6ca6f0c2f467c59013fba92 SHA512 6fc72197b684abc343480acb66b8f749c186bd7a031ddd757c4a0e5fd8fdeda0cde9c9e634fd3d9e2b2d1ed96019c5f8e7119ad10a7f51d5dc13fac2571c6c70
diff --git a/sys-apps/systemd/files/251-revert-fortify-source-3-fix.patch b/sys-apps/systemd/files/251-revert-fortify-source-3-fix.patch
new file mode 100644
index 000000000000..bbe45f85dcf2
--- /dev/null
+++ b/sys-apps/systemd/files/251-revert-fortify-source-3-fix.patch
@@ -0,0 +1,40 @@
+From: Sam James <sam@gentoo.org>
+Date: Tue, 24 May 2022 23:21:50 +0100
+Subject: [PATCH] Revert "Support -D_FORTIFY_SOURCE=3 by using
+ __builtin_dynamic_object_size."
+
+Breaks Clang (even without F_S=3).
+
+This reverts commit 0bd292567a543d124cd303f7dd61169a209cae64.
+
+Bug: https://bugs.gentoo.org/841770
+Bug: https://github.com/systemd/systemd/issues/23150
+--- a/src/basic/alloc-util.h
++++ b/src/basic/alloc-util.h
+@@ -174,23 +174,13 @@ void* greedy_realloc0(void **p, size_t need, size_t size);
+ * is compatible with _FORTIFY_SOURCES. If _FORTIFY_SOURCES is used many memory operations will take the
+ * object size as returned by __builtin_object_size() into account. Hence, let's return the smaller size of
+ * malloc_usable_size() and __builtin_object_size() here, so that we definitely operate in safe territory by
+- * both the compiler's and libc's standards. Note that _FORTIFY_SOURCES=3 handles also dynamically allocated
+- * objects and thus it's safer using __builtin_dynamic_object_size if _FORTIFY_SOURCES=3 is used (#22801).
+- * Moreover, when NULL is passed malloc_usable_size() is documented to return zero, and
++ * both the compiler's and libc's standards. Note that __builtin_object_size() evaluates to SIZE_MAX if the
++ * size cannot be determined, hence the MIN() expression should be safe with dynamically sized memory,
++ * too. Moreover, when NULL is passed malloc_usable_size() is documented to return zero, and
+ * __builtin_object_size() returns SIZE_MAX too, hence we also return a sensible value of 0 in this corner
+ * case. */
+-
+-#if defined __has_builtin
+-# if __has_builtin(__builtin_dynamic_object_size)
+-# define MALLOC_SIZEOF_SAFE(x) \
+- MIN(malloc_usable_size(x), __builtin_dynamic_object_size(x, 0))
+-# endif
+-#endif
+-
+-#ifndef MALLOC_SIZEOF_SAFE
+ #define MALLOC_SIZEOF_SAFE(x) \
+ MIN(malloc_usable_size(x), __builtin_object_size(x, 0))
+-#endif
+
+ /* Inspired by ELEMENTSOF() but operates on malloc()'ed memory areas: typesafely returns the number of items
+ * that fit into the specified memory block */
diff --git a/sys-apps/systemd/systemd-9999.ebuild b/sys-apps/systemd/systemd-251.1.ebuild
similarity index 94%
copy from sys-apps/systemd/systemd-9999.ebuild
copy to sys-apps/systemd/systemd-251.1.ebuild
index 8d12de0b47a7..9381570446ab 100644
--- a/sys-apps/systemd/systemd-9999.ebuild
+++ b/sys-apps/systemd/systemd-251.1.ebuild
@@ -23,7 +23,7 @@ else
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
fi
-inherit bash-completion-r1 linux-info meson-multilib pam python-any-r1 systemd toolchain-funcs udev usr-ldscript
+inherit bash-completion-r1 flag-o-matic linux-info meson-multilib pam python-any-r1 systemd toolchain-funcs udev usr-ldscript
DESCRIPTION="System and service manager for Linux"
HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
@@ -235,6 +235,10 @@ src_prepare() {
# Add local patches here
PATCHES+=(
+ "${FILESDIR}/251-format-string.patch"
+ # Breaks Clang. Revert the commit for now and force off F_S=3.
+ # bug #841770.
+ "${FILESDIR}/251-revert-fortify-source-3-fix.patch"
)
if ! use vanilla; then
@@ -255,6 +259,21 @@ src_configure() {
# Prevent conflicts with i686 cross toolchain, bug 559726
tc-export AR CC NM OBJCOPY RANLIB
+ # Broken with FORTIFY_SOURCE=3 without a patch. We have to revert
+ # the upstream patch for it because it breaks Clang: bug #841770.
+ #
+ # Our toolchain sets F_S=2 by default w/ >= -O2, so we need
+ # to unset F_S first, then explicitly set 2, to negate any default
+ # and anything set by the user if they're choosing 3 (or if they've
+ # modified GCC to set 3).
+ #
+ if is-flagq '-O[23]' || is-flagq '-Ofast' ; then
+ # We can't unconditionally do this b/c we fortify needs
+ # some level of optimisation.
+ filter-flags -D_FORTIFY_SOURCE=3
+ append-cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
+ fi
+
python_setup
multilib-minimal_src_configure
diff --git a/sys-apps/systemd/systemd-9999.ebuild b/sys-apps/systemd/systemd-9999.ebuild
index 8d12de0b47a7..efeb0fe26832 100644
--- a/sys-apps/systemd/systemd-9999.ebuild
+++ b/sys-apps/systemd/systemd-9999.ebuild
@@ -23,7 +23,7 @@ else
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
fi
-inherit bash-completion-r1 linux-info meson-multilib pam python-any-r1 systemd toolchain-funcs udev usr-ldscript
+inherit bash-completion-r1 flag-o-matic linux-info meson-multilib pam python-any-r1 systemd toolchain-funcs udev usr-ldscript
DESCRIPTION="System and service manager for Linux"
HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
@@ -235,6 +235,9 @@ src_prepare() {
# Add local patches here
PATCHES+=(
+ # Breaks Clang. Revert the commit for now and force off F_S=3.
+ # bug #841770.
+ "${FILESDIR}/251-revert-fortify-source-3-fix.patch"
)
if ! use vanilla; then
@@ -255,6 +258,21 @@ src_configure() {
# Prevent conflicts with i686 cross toolchain, bug 559726
tc-export AR CC NM OBJCOPY RANLIB
+ # Broken with FORTIFY_SOURCE=3 without a patch. We have to revert
+ # the upstream patch for it because it breaks Clang: bug #841770.
+ #
+ # Our toolchain sets F_S=2 by default w/ >= -O2, so we need
+ # to unset F_S first, then explicitly set 2, to negate any default
+ # and anything set by the user if they're choosing 3 (or if they've
+ # modified GCC to set 3).
+ #
+ if is-flagq '-O[23]' || is-flagq '-Ofast' ; then
+ # We can't unconditionally do this b/c we fortify needs
+ # some level of optimisation.
+ filter-flags -D_FORTIFY_SOURCE=3
+ append-cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
+ fi
+
python_setup
multilib-minimal_src_configure
next reply other threads:[~2022-05-24 22:36 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 22:35 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-09-30 20:05 [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/files/, sys-apps/systemd/ Mike Gilbert
2025-09-29 15:45 Mike Gilbert
2025-09-26 17:04 Mike Gilbert
2025-06-04 2:01 Mike Gilbert
2024-09-26 19:15 Mike Gilbert
2024-04-29 17:27 Sam James
2023-12-28 3:53 Sam James
2023-07-06 8:15 Sam James
2023-05-05 4:13 Sam James
2023-04-29 3:50 Mike Gilbert
2023-01-30 2:14 Mike Gilbert
2023-01-13 20:06 Mike Gilbert
2023-01-13 5:33 Sam James
2023-01-11 7:50 Sam James
2022-10-15 18:57 Mike Gilbert
2022-10-14 21:18 Sam James
2022-09-18 15:52 Mike Gilbert
2022-08-02 23:40 Sam James
2022-05-23 18:35 Mike Gilbert
2022-05-21 22:22 Mike Gilbert
2022-05-07 18:32 Mike Gilbert
2022-04-30 0:30 Sam James
2022-04-28 1:26 Sam James
2022-01-15 15:41 Mike Gilbert
2022-01-13 16:29 Mike Gilbert
2021-10-26 15:00 Mike Gilbert
2021-07-20 19:19 Mike Gilbert
2021-07-11 14:41 Mike Gilbert
2021-06-20 17:33 Mike Gilbert
2021-04-27 18:16 Mike Gilbert
2021-03-17 14:19 Mike Gilbert
2020-11-03 15:48 Mike Gilbert
2020-10-14 19:15 Mike Gilbert
2020-09-24 14:51 Mike Gilbert
2020-08-22 1:56 Mike Gilbert
2020-07-06 14:05 Mike Gilbert
2020-06-11 2:29 Mike Gilbert
2020-03-09 21:22 Mike Gilbert
2020-01-26 17:19 Mike Gilbert
2020-01-07 7:19 Mike Gilbert
2019-09-03 15:27 Mike Gilbert
2019-07-31 14:06 Mike Gilbert
2019-06-17 16:19 Mike Gilbert
2019-05-23 12:26 Louis Sautier
2019-05-09 13:41 Mike Gilbert
2019-05-08 17:29 Mike Gilbert
2019-04-05 20:56 Mike Gilbert
2018-10-30 14:34 Mike Gilbert
2018-09-29 15:27 Mike Gilbert
2018-03-26 21:14 Pacho Ramos
2017-12-31 1:40 Mike Gilbert
2017-12-28 16:01 Mike Gilbert
2017-10-28 18:58 Mike Gilbert
2017-10-08 17:11 Mike Gilbert
2017-09-08 21:16 Mike Gilbert
2017-08-13 23:32 Mike Gilbert
2017-07-12 20:23 Mike Gilbert
2017-06-28 17:01 Mike Gilbert
2017-03-12 17:59 Mike Gilbert
2017-01-03 18:15 Mike Gilbert
2016-12-18 23:08 Mike Gilbert
2016-04-16 20:32 Mike Gilbert
2015-12-12 15:17 Mike Gilbert
2015-11-24 16:28 Mike Gilbert
2015-10-25 9:11 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1653431750.eb84c4b6a972b074bc60f64d3348e93602795df1.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox