diff options
author | Mike Gilbert <floppym@gentoo.org> | 2022-09-18 11:39:56 -0400 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2022-09-18 11:47:07 -0400 |
commit | 05e25e63567cfb77adde5e4c05ba99c907cb7f96 (patch) | |
tree | 1be035b2e1bea627688906a0de1be1aca862d2dc /sys-apps/systemd-utils | |
parent | net-im/zoom: drop 5.11.3.3882-r1 (diff) | |
download | gentoo-05e25e63567cfb77adde5e4c05ba99c907cb7f96.tar.gz gentoo-05e25e63567cfb77adde5e4c05ba99c907cb7f96.tar.bz2 gentoo-05e25e63567cfb77adde5e4c05ba99c907cb7f96.zip |
sys-apps/systemd-utils: copy revert-fortify-source patch from systemd
Closes: https://bugs.gentoo.org/870262
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'sys-apps/systemd-utils')
-rw-r--r-- | sys-apps/systemd-utils/files/251-revert-fortify-source-3-fix.patch | 40 | ||||
-rw-r--r-- | sys-apps/systemd-utils/systemd-utils-251.4-r2.ebuild (renamed from sys-apps/systemd-utils/systemd-utils-251.4-r1.ebuild) | 8 |
2 files changed, 47 insertions, 1 deletions
diff --git a/sys-apps/systemd-utils/files/251-revert-fortify-source-3-fix.patch b/sys-apps/systemd-utils/files/251-revert-fortify-source-3-fix.patch new file mode 100644 index 000000000000..bbe45f85dcf2 --- /dev/null +++ b/sys-apps/systemd-utils/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-utils/systemd-utils-251.4-r1.ebuild b/sys-apps/systemd-utils/systemd-utils-251.4-r2.ebuild index 9cb9d0cb2ceb..9aa951a441cd 100644 --- a/sys-apps/systemd-utils/systemd-utils-251.4-r1.ebuild +++ b/sys-apps/systemd-utils/systemd-utils-251.4-r2.ebuild @@ -105,6 +105,8 @@ QA_FLAGS_IGNORED="usr/lib/systemd/boot/efi/.*" src_prepare() { local PATCHES=( + # Breaks Clang. Revert the commit for now and force off F_S=3. + "${FILESDIR}/251-revert-fortify-source-3-fix.patch" ) if use elibc_musl; then @@ -120,7 +122,7 @@ src_prepare() { sed -i -e "/${rpath_pattern}/d" meson.build || die } -multilib_src_configure() { +src_configure() { # When bumping to 251, please keep this, but add the revert patch # like in sys-apps/systemd! # @@ -140,6 +142,10 @@ multilib_src_configure() { append-cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 fi + multilib-minimal_src_configure +} + +multilib_src_configure() { local emesonargs=( $(meson_use split-usr) $(meson_use split-usr split-bin) |