Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/, sys-apps/systemd/files/
Date: Thu, 05 Apr 2018 22:40:56
Message-Id: 1522959112.3ffe8430672993cfc0d8d0b3abdf4d777cf3fdc1.floppym@gentoo
1 commit: 3ffe8430672993cfc0d8d0b3abdf4d777cf3fdc1
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 5 20:11:52 2018 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 5 20:11:52 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ffe8430
7
8 sys-apps/systemd: fix regression in nspawn network setup
9
10 Closes: https://bugs.gentoo.org/652396
11 Package-Manager: Portage-2.3.24, Repoman-2.3.6_p81
12
13 sys-apps/systemd/files/238-nspawn-wait.patch | 83 ++++++++++++++++++++++
14 ...systemd-238-r3.ebuild => systemd-238-r4.ebuild} | 1 +
15 2 files changed, 84 insertions(+)
16
17 diff --git a/sys-apps/systemd/files/238-nspawn-wait.patch b/sys-apps/systemd/files/238-nspawn-wait.patch
18 new file mode 100644
19 index 00000000000..a740e893345
20 --- /dev/null
21 +++ b/sys-apps/systemd/files/238-nspawn-wait.patch
22 @@ -0,0 +1,83 @@
23 +From 7511655807e90aa33ea7b71991401a79ec36bb41 Mon Sep 17 00:00:00 2001
24 +From: Philip Sequeira <phsequei@×××××.com>
25 +Date: Thu, 5 Apr 2018 14:04:27 +0000
26 +Subject: [PATCH] nspawn: wait for network namespace creation before interface
27 + setup (#8633)
28 +
29 +Otherwise, network interfaces can be "moved" into the container's
30 +namespace while it's still the same as the host namespace, in which case
31 +e.g. host0 for a veth ends up on the host side instead of inside the
32 +container.
33 +
34 +Regression introduced in 0441378080489e4ab6704cd0a2d78cb1ceaca899.
35 +
36 +Fixes #8599.
37 +---
38 + src/nspawn/nspawn.c | 19 +++++++++++++++----
39 + 1 file changed, 15 insertions(+), 4 deletions(-)
40 +
41 +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
42 +index 810f1247ea2..a5bc50c1f4c 100644
43 +--- a/src/nspawn/nspawn.c
44 ++++ b/src/nspawn/nspawn.c
45 +@@ -2329,6 +2329,9 @@ static int inner_child(
46 + r = unshare(CLONE_NEWNET);
47 + if (r < 0)
48 + return log_error_errno(errno, "Failed to unshare network namespace: %m");
49 ++
50 ++ /* Tell the parent that it can setup network interfaces. */
51 ++ (void) barrier_place(barrier); /* #3 */
52 + }
53 +
54 + r = mount_sysfs(NULL, arg_mount_settings);
55 +@@ -2337,7 +2340,7 @@ static int inner_child(
56 +
57 + /* Wait until we are cgroup-ified, so that we
58 + * can mount the right cgroup path writable */
59 +- if (!barrier_place_and_sync(barrier)) { /* #3 */
60 ++ if (!barrier_place_and_sync(barrier)) { /* #4 */
61 + log_error("Parent died too early");
62 + return -ESRCH;
63 + }
64 +@@ -2448,7 +2451,7 @@ static int inner_child(
65 + /* Let the parent know that we are ready and
66 + * wait until the parent is ready with the
67 + * setup, too... */
68 +- if (!barrier_place_and_sync(barrier)) { /* #4 */
69 ++ if (!barrier_place_and_sync(barrier)) { /* #5 */
70 + log_error("Parent died too early");
71 + return -ESRCH;
72 + }
73 +@@ -3533,6 +3536,14 @@ static int run(int master,
74 +
75 + if (arg_private_network) {
76 +
77 ++ if (!arg_network_namespace_path) {
78 ++ /* Wait until the child has unshared its network namespace. */
79 ++ if (!barrier_place_and_sync(&barrier)) { /* #3 */
80 ++ log_error("Child died too early");
81 ++ return -ESRCH;
82 ++ }
83 ++ }
84 ++
85 + r = move_network_interfaces(*pid, arg_network_interfaces);
86 + if (r < 0)
87 + return r;
88 +@@ -3656,7 +3667,7 @@ static int run(int master,
89 + * its setup (including cgroup-ification), and that
90 + * the child can now hand over control to the code to
91 + * run inside the container. */
92 +- (void) barrier_place(&barrier); /* #3 */
93 ++ (void) barrier_place(&barrier); /* #4 */
94 +
95 + /* Block SIGCHLD here, before notifying child.
96 + * process_pty() will handle it with the other signals. */
97 +@@ -3684,7 +3695,7 @@ static int run(int master,
98 + return r;
99 +
100 + /* Let the child know that we are ready and wait that the child is completely ready now. */
101 +- if (!barrier_place_and_sync(&barrier)) { /* #4 */
102 ++ if (!barrier_place_and_sync(&barrier)) { /* #5 */
103 + log_error("Child died too early.");
104 + return -ESRCH;
105 + }
106
107 diff --git a/sys-apps/systemd/systemd-238-r3.ebuild b/sys-apps/systemd/systemd-238-r4.ebuild
108 similarity index 99%
109 rename from sys-apps/systemd/systemd-238-r3.ebuild
110 rename to sys-apps/systemd/systemd-238-r4.ebuild
111 index b68ed0bf92a..0aca5fbb302 100644
112 --- a/sys-apps/systemd/systemd-238-r3.ebuild
113 +++ b/sys-apps/systemd/systemd-238-r4.ebuild
114 @@ -155,6 +155,7 @@ src_prepare() {
115 PATCHES+=(
116 "${FILESDIR}/238-libmount-include.patch"
117 "${FILESDIR}/238-initctl.patch"
118 + "${FILESDIR}/238-nspawn-wait.patch"
119 )
120
121 if ! use vanilla; then