nspawn: remove uuid socket

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
This commit is contained in:
Christian Brauner
2022-12-13 15:25:45 +01:00
parent b1e1d1fa48
commit 1823d92d7b
+2 -13
View File
@@ -3629,7 +3629,6 @@ static int outer_child(
const char *directory,
DissectedImage *dissected_image,
bool secondary,
int uuid_socket,
int fd_socket,
int kmsg_socket,
int rtnl_socket,
@@ -3656,7 +3655,6 @@ static int outer_child(
assert(barrier);
assert(directory);
assert(uuid_socket >= 0);
assert(fd_socket >= 0);
assert(master_pty_socket >= 0);
assert(kmsg_socket >= 0);
@@ -4022,7 +4020,6 @@ static int outer_child(
if (pid < 0)
return log_error_errno(errno, "Failed to fork inner child: %m");
if (pid == 0) {
uuid_socket = safe_close(uuid_socket);
fd_socket = safe_close(fd_socket);
uid_shift_socket = safe_close(uid_shift_socket);
@@ -4049,7 +4046,7 @@ static int outer_child(
return log_error_errno(SYNTHETIC_ERRNO(EIO),
"Short write while sending PID.");
l = send(uuid_socket, &arg_uuid, sizeof(arg_uuid), MSG_NOSIGNAL);
l = send(fd_socket, &arg_uuid, sizeof(arg_uuid), MSG_NOSIGNAL);
if (l < 0)
return log_error_errno(errno, "Failed to send machine ID: %m");
if (l != sizeof(arg_uuid))
@@ -4060,7 +4057,6 @@ static int outer_child(
if (l < 0)
return log_error_errno(l, "Failed to send notify fd: %m");
uuid_socket = safe_close(uuid_socket);
fd_socket = safe_close(fd_socket);
master_pty_socket = safe_close(master_pty_socket);
kmsg_socket = safe_close(kmsg_socket);
@@ -4765,7 +4761,6 @@ static int run_container(
_cleanup_close_pair_ int
kmsg_socket_pair[2] = { -1, -1 },
rtnl_socket_pair[2] = { -1, -1 },
uuid_socket_pair[2] = { -1, -1 },
fd_socket_pair[2] = { -EBADF, -EBADF },
uid_shift_socket_pair[2] = { -1, -1 },
master_pty_socket_pair[2] = { -1, -1 },
@@ -4812,9 +4807,6 @@ static int run_container(
if (socketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CLOEXEC, 0, rtnl_socket_pair) < 0)
return log_error_errno(errno, "Failed to create rtnl socket pair: %m");
if (socketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CLOEXEC, 0, uuid_socket_pair) < 0)
return log_error_errno(errno, "Failed to create id socket pair: %m");
if (socketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CLOEXEC, 0, fd_socket_pair) < 0)
return log_error_errno(errno, "Failed to create notify socket pair: %m");
@@ -4866,7 +4858,6 @@ static int run_container(
kmsg_socket_pair[0] = safe_close(kmsg_socket_pair[0]);
rtnl_socket_pair[0] = safe_close(rtnl_socket_pair[0]);
uuid_socket_pair[0] = safe_close(uuid_socket_pair[0]);
fd_socket_pair[0] = safe_close(fd_socket_pair[0]);
master_pty_socket_pair[0] = safe_close(master_pty_socket_pair[0]);
uid_shift_socket_pair[0] = safe_close(uid_shift_socket_pair[0]);
@@ -4879,7 +4870,6 @@ static int run_container(
arg_directory,
dissected_image,
secondary,
uuid_socket_pair[1],
fd_socket_pair[1],
kmsg_socket_pair[1],
rtnl_socket_pair[1],
@@ -4900,7 +4890,6 @@ static int run_container(
kmsg_socket_pair[1] = safe_close(kmsg_socket_pair[1]);
rtnl_socket_pair[1] = safe_close(rtnl_socket_pair[1]);
uuid_socket_pair[1] = safe_close(uuid_socket_pair[1]);
fd_socket_pair[1] = safe_close(fd_socket_pair[1]);
master_pty_socket_pair[1] = safe_close(master_pty_socket_pair[1]);
uid_shift_socket_pair[1] = safe_close(uid_shift_socket_pair[1]);
@@ -4980,7 +4969,7 @@ static int run_container(
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read while reading inner child PID.");
/* We also retrieve container UUID in case it was generated by outer child */
l = recv(uuid_socket_pair[0], &arg_uuid, sizeof arg_uuid, 0);
l = recv(fd_socket_pair[0], &arg_uuid, sizeof arg_uuid, 0);
if (l < 0)
return log_error_errno(errno, "Failed to read container machine ID: %m");
if (l != sizeof(arg_uuid))