]> git.proxmox.com Git - mirror_lxc.git/commitdiff
lxc_unshare: make mount table private
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 5 Jul 2021 10:11:42 +0000 (12:11 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 5 Jul 2021 10:11:42 +0000 (12:11 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_unshare.c

index b4b073a02f1cbd2d5077fbe035508823839808da..8e4716cf3a8f84e78abe821da8360370d3c930d4 100644 (file)
@@ -246,8 +246,13 @@ static int do_start(void *arg)
                }
        }
 
-       if ((start_arg->flags & CLONE_NEWNS) && start_arg->want_default_mounts)
-               lxc_setup_fs();
+       if (start_arg->flags & CLONE_NEWNS) {
+               if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0) < 0)
+                       _exit(EXIT_FAILURE);
+
+               if (start_arg->want_default_mounts)
+                       lxc_setup_fs();
+       }
 
        if ((start_arg->flags & CLONE_NEWUTS) && want_hostname)
                if (sethostname(want_hostname, strlen(want_hostname)) < 0) {