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-libs/glibc/files/, sys-libs/glibc/
Date: Wed, 01 Dec 2021 15:09:48
Message-Id: 1638371372.6c160db5f224ffa6d45c54ffb2636047d567f804.sam@gentoo
1 commit: 6c160db5f224ffa6d45c54ffb2636047d567f804
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 1 15:07:42 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 1 15:09:32 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c160db5
7
8 sys-libs/glibc: make non-functional changes to clone3 patch
9
10 Making it conditional based on a #define so that we can
11 easily unconditionally apply it.
12
13 Signed-off-by: Sam James <sam <AT> gentoo.org>
14
15 ... glibc-2.34-make-clone3-syscall-optional.patch} | 38 ++++++++++++++--------
16 sys-libs/glibc/glibc-2.34-r3.ebuild | 10 ++++--
17 2 files changed, 31 insertions(+), 17 deletions(-)
18
19 diff --git a/sys-libs/glibc/files/glibc-2.34-disable-clone3-syscall.patch b/sys-libs/glibc/files/glibc-2.34-make-clone3-syscall-optional.patch
20 similarity index 53%
21 rename from sys-libs/glibc/files/glibc-2.34-disable-clone3-syscall.patch
22 rename to sys-libs/glibc/files/glibc-2.34-make-clone3-syscall-optional.patch
23 index 3c65a125c3b4..bbc6cabb463d 100644
24 --- a/sys-libs/glibc/files/glibc-2.34-disable-clone3-syscall.patch
25 +++ b/sys-libs/glibc/files/glibc-2.34-make-clone3-syscall-optional.patch
26 @@ -1,6 +1,14 @@
27 +From 22afb7abbfa0e2d4d168dcd2844aa9935a71cb37 Mon Sep 17 00:00:00 2001
28 +From: Sam James <sam@g.o>
29 +Date: Wed, 1 Dec 2021 14:58:40 +0000
30 +Subject: [PATCH] clone-internal.c: disable use of clone3 conditinally
31 +
32 We're disabling clone3 for now _CONDITIONALLY_ (not by default) to allow
33 compatibility with applications using older Electron.
34
35 +Use -DGENTOO_USE_CLONE3 to enable clone3 for now. In future, we will
36 +revert back to always using clone3.
37 +
38 This was impacting e.g. Discord and Skype. This patch stops glibc from using
39 clone3 internally (which is the only real use of it) and falls back to the old
40 behaviour.
41 @@ -16,23 +24,25 @@ https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/glibc/plain/debian/pat
42 This is the same as the patch that was considered but ultimately rejected
43 for 2.34 because Docker got sorted out in time:
44 https://patchwork.ozlabs.org/project/glibc/patch/87eebkf8ph.fsf@××××××××××××××××××××.com/.
45 +
46 +Signed-off-by: Sam James <sam@g.o>
47 +---
48 + sysdeps/unix/sysv/linux/clone-internal.c | 2 +-
49 + 1 file changed, 1 insertion(+), 1 deletion(-)
50 +
51 +diff --git a/sysdeps/unix/sysv/linux/clone-internal.c b/sysdeps/unix/sysv/linux/clone-internal.c
52 +index 979f7880be..c5566daf73 100644
53 --- a/sysdeps/unix/sysv/linux/clone-internal.c
54 +++ b/sysdeps/unix/sysv/linux/clone-internal.c
55 -@@ -48,17 +48,6 @@
56 +@@ -48,7 +48,7 @@ __clone_internal (struct clone_args *cl_args,
57 int (*func) (void *arg), void *arg)
58 {
59 int ret;
60 -#ifdef HAVE_CLONE3_WRAPPER
61 -- /* Try clone3 first. */
62 -- int saved_errno = errno;
63 -- ret = __clone3 (cl_args, sizeof (*cl_args), func, arg);
64 -- if (ret != -1 || errno != ENOSYS)
65 -- return ret;
66 --
67 -- /* NB: Restore errno since errno may be checked against non-zero
68 -- return value. */
69 -- __set_errno (saved_errno);
70 --#endif
71 -
72 - /* Map clone3 arguments to clone arguments. NB: No need to check
73 - invalid clone3 specific bits in flags nor exit_signal since this
74 ++#if defined(HAVE_CLONE3_WRAPPER) && defined(GENTOO_USE_CLONE3)
75 + /* Try clone3 first. */
76 + int saved_errno = errno;
77 + ret = __clone3 (cl_args, sizeof (*cl_args), func, arg);
78 +--
79 +2.34.1
80 +
81
82 diff --git a/sys-libs/glibc/glibc-2.34-r3.ebuild b/sys-libs/glibc/glibc-2.34-r3.ebuild
83 index d98d8a72fba5..7053b85282f1 100644
84 --- a/sys-libs/glibc/glibc-2.34-r3.ebuild
85 +++ b/sys-libs/glibc/glibc-2.34-r3.ebuild
86 @@ -791,11 +791,15 @@ src_prepare() {
87 einfo "Done."
88 fi
89
90 - if ! use clone3 ; then
91 + # Apply patch to allow conditional disabling of clone3
92 + eapply "${FILESDIR}"/${PN}-2.34-make-clone3-syscall-optional.patch
93 +
94 + if use clone3 ; then
95 + append-cppflags -DGENTOO_USE_CLONE3
96 + else
97 + # See e.g. bug #827386, bug #819045.
98 elog "Disabling the clone3 syscall for compatibility with older Electron apps."
99 elog "Please re-enable this flag before filing bugs!"
100 - # See e.g. bug #827386, bug #819045.
101 - eapply "${FILESDIR}"/${P}-disable-clone3-syscall.patch
102 fi
103
104 default