From: Pedro Tammela Date: Wed, 1 Mar 2023 16:09:47 +0000 (+0100) Subject: libmount: idmap: fix sock write to child X-Git-Tag: v2.39-rc1~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=567700dfdbcd0a237e274380673a0cb83e78ce06;p=thirdparty%2Futil-linux.git libmount: idmap: fix sock write to child The current code writes to sock_fds[0], which is set to -1 on line 227, instead of the correct sock_fds[1]. As a cause, a simple `mount` command which uses idmapping and doesn't specify a user ns hangs indefinitely. --- diff --git a/libmount/src/hook_idmap.c b/libmount/src/hook_idmap.c index 7e7c9e742f..9306e5d971 100644 --- a/libmount/src/hook_idmap.c +++ b/libmount/src/hook_idmap.c @@ -240,7 +240,7 @@ static int get_userns_fd_from_idmap(struct list_head *idmap) fd_userns = open(path, O_RDONLY | O_CLOEXEC | O_NOCTTY); /* Let child know we've persisted its namespace. */ - (void)write_all(sock_fds[0], &c, 1); + (void)write_all(sock_fds[1], &c, 1); err_wait: rc = wait_for_pid(pid);