Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/files/, sys-apps/systemd/
Date: Sat, 30 Apr 2022 00:30:46
Message-Id: 1651278621.241570c597a6878e55f3e40ea357dfb3120b7599.sam@gentoo
1 commit: 241570c597a6878e55f3e40ea357dfb3120b7599
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 30 00:30:00 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 30 00:30:21 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=241570c5
7
8 sys-apps/systemd: drop FORTIFY_SOURCE=3 patch for now
9
10 May cause runtime issues for some without using FORTIFY_SOURCE? (Not seen
11 this myself but let's be safe.)
12
13 Note that reported issue is only w/ GCC 12 anyway which is not yet
14 released.
15
16 Bug: https://bugs.gentoo.org/841770
17 Signed-off-by: Sam James <sam <AT> gentoo.org>
18
19 .../files/250.4-fortify-source-3-malloc.patch | 42 ----------------------
20 ...emd-250.4-r1.ebuild => systemd-250.4-r2.ebuild} | 1 -
21 ...ystemd-250.5.ebuild => systemd-250.5-r1.ebuild} | 1 -
22 3 files changed, 44 deletions(-)
23
24 diff --git a/sys-apps/systemd/files/250.4-fortify-source-3-malloc.patch b/sys-apps/systemd/files/250.4-fortify-source-3-malloc.patch
25 deleted file mode 100644
26 index ed9eb80f21fa..000000000000
27 --- a/sys-apps/systemd/files/250.4-fortify-source-3-malloc.patch
28 +++ /dev/null
29 @@ -1,42 +0,0 @@
30 -https://github.com/systemd/systemd/commit/0bd292567a543d124cd303f7dd61169a209cae64
31 -
32 -From 0bd292567a543d124cd303f7dd61169a209cae64 Mon Sep 17 00:00:00 2001
33 -From: Martin Liska <mliska@××××.cz>
34 -Date: Thu, 31 Mar 2022 10:27:45 +0200
35 -Subject: [PATCH] Support -D_FORTIFY_SOURCE=3 by using
36 - __builtin_dynamic_object_size.
37 -
38 -As explained in the issue, -D_FORTIFY_SOURCE=3 requires usage
39 -of __builtin_dynamic_object_size in MALLOC_SIZEOF_SAFE macro.
40 -
41 -Fixes: #22801
42 ---- a/src/basic/alloc-util.h
43 -+++ b/src/basic/alloc-util.h
44 -@@ -174,13 +174,23 @@ void* greedy_realloc0(void **p, size_t need, size_t size);
45 - * is compatible with _FORTIFY_SOURCES. If _FORTIFY_SOURCES is used many memory operations will take the
46 - * object size as returned by __builtin_object_size() into account. Hence, let's return the smaller size of
47 - * malloc_usable_size() and __builtin_object_size() here, so that we definitely operate in safe territory by
48 -- * both the compiler's and libc's standards. Note that __builtin_object_size() evaluates to SIZE_MAX if the
49 -- * size cannot be determined, hence the MIN() expression should be safe with dynamically sized memory,
50 -- * too. Moreover, when NULL is passed malloc_usable_size() is documented to return zero, and
51 -+ * both the compiler's and libc's standards. Note that _FORTIFY_SOURCES=3 handles also dynamically allocated
52 -+ * objects and thus it's safer using __builtin_dynamic_object_size if _FORTIFY_SOURCES=3 is used (#22801).
53 -+ * Moreover, when NULL is passed malloc_usable_size() is documented to return zero, and
54 - * __builtin_object_size() returns SIZE_MAX too, hence we also return a sensible value of 0 in this corner
55 - * case. */
56 -+
57 -+#if defined __has_builtin
58 -+# if __has_builtin(__builtin_dynamic_object_size)
59 -+# define MALLOC_SIZEOF_SAFE(x) \
60 -+ MIN(malloc_usable_size(x), __builtin_dynamic_object_size(x, 0))
61 -+# endif
62 -+#endif
63 -+
64 -+#ifndef MALLOC_SIZEOF_SAFE
65 - #define MALLOC_SIZEOF_SAFE(x) \
66 - MIN(malloc_usable_size(x), __builtin_object_size(x, 0))
67 -+#endif
68 -
69 - /* Inspired by ELEMENTSOF() but operates on malloc()'ed memory areas: typesafely returns the number of items
70 - * that fit into the specified memory block */
71 -
72
73 diff --git a/sys-apps/systemd/systemd-250.4-r1.ebuild b/sys-apps/systemd/systemd-250.4-r2.ebuild
74 similarity index 99%
75 rename from sys-apps/systemd/systemd-250.4-r1.ebuild
76 rename to sys-apps/systemd/systemd-250.4-r2.ebuild
77 index 8b3ea6a36203..270bfe1cff71 100644
78 --- a/sys-apps/systemd/systemd-250.4-r1.ebuild
79 +++ b/sys-apps/systemd/systemd-250.4-r2.ebuild
80 @@ -244,7 +244,6 @@ src_prepare() {
81 # Add local patches here
82 PATCHES+=(
83 "${FILESDIR}/250.4-random-seed-hash.patch"
84 - "${FILESDIR}/250.4-fortify-source-3-malloc.patch"
85 )
86
87 if ! use vanilla; then
88
89 diff --git a/sys-apps/systemd/systemd-250.5.ebuild b/sys-apps/systemd/systemd-250.5-r1.ebuild
90 similarity index 99%
91 rename from sys-apps/systemd/systemd-250.5.ebuild
92 rename to sys-apps/systemd/systemd-250.5-r1.ebuild
93 index 1b51f0304d78..f5f763e60f72 100644
94 --- a/sys-apps/systemd/systemd-250.5.ebuild
95 +++ b/sys-apps/systemd/systemd-250.5-r1.ebuild
96 @@ -243,7 +243,6 @@ src_prepare() {
97
98 # Add local patches here
99 PATCHES+=(
100 - "${FILESDIR}/250.4-fortify-source-3-malloc.patch"
101 )
102
103 if ! use vanilla; then