]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: idmap: fix sock write to child
authorPedro Tammela <pctammela@mojatatu.com>
Wed, 1 Mar 2023 16:09:47 +0000 (17:09 +0100)
committerGitHub <noreply@github.com>
Wed, 1 Mar 2023 16:09:47 +0000 (17:09 +0100)
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.

libmount/src/hook_idmap.c

index 7e7c9e742fd2eb4181573fcc751061737d73943d..9306e5d9711f857e0acf3b0fe99075a8f5d3d20e 100644 (file)
@@ -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);