From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4EF73158090 for ; Tue, 24 May 2022 22:36:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 72DF8E0825; Tue, 24 May 2022 22:36:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4C5CEE0825 for ; Tue, 24 May 2022 22:36:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 02101341538 for ; Tue, 24 May 2022 22:36:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EEEC0464 for ; Tue, 24 May 2022 22:35:58 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1653431750.eb84c4b6a972b074bc60f64d3348e93602795df1.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/files/, sys-apps/systemd/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-apps/systemd/Manifest sys-apps/systemd/files/251-revert-fortify-source-3-fix.patch sys-apps/systemd/systemd-251.1.ebuild sys-apps/systemd/systemd-9999.ebuild X-VCS-Directories: sys-apps/systemd/files/ sys-apps/systemd/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: eb84c4b6a972b074bc60f64d3348e93602795df1 X-VCS-Branch: master Date: Tue, 24 May 2022 22:35:58 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5e6a298e-9f59-4159-adb5-06ecf4ac1ed7 X-Archives-Hash: fb230f9115a5d6b3c07a002a9c794002 commit: eb84c4b6a972b074bc60f64d3348e93602795df1 Author: Sam James gentoo org> AuthorDate: Tue May 24 22:27:45 2022 +0000 Commit: Sam James gentoo 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 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 +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