lxc_unshare: make mount table private

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2021-07-05 12:11:42 +02:00
parent b235962c17
commit ecd92dffbc
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View 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) {