ostbuild: Ensure user chroot mounts are not shared

It's possible that the root filesystem mount is global; we need
to undo that in order to be sure that our "private" bind mounts
really are private.
This commit is contained in:
Colin Walters 2011-12-06 12:18:17 -05:00
parent e68d0d25c0
commit 0fb40b201f
1 changed files with 3 additions and 0 deletions

View File

@ -98,6 +98,9 @@ main (int argc,
if (unshare (CLONE_NEWNS) < 0) if (unshare (CLONE_NEWNS) < 0)
fatal_errno ("unshare (CLONE_NEWNS)"); fatal_errno ("unshare (CLONE_NEWNS)");
if (mount ("/", "/", "none", MS_PRIVATE, NULL) < 0)
fatal_errno ("mount(/, MS_PRIVATE)");
initialize_chroot (chroot_dir); initialize_chroot (chroot_dir);
if (chroot (chroot_dir) < 0) if (chroot (chroot_dir) < 0)