Skip to content

Commit

Permalink
merge branch 'pr-1500'
Browse files Browse the repository at this point in the history
  rootfs: switch ms_private remount of oldroot to ms_slave

LGTMs: @crosbymichael @hqhq
Closes #1500
  • Loading branch information
cyphar committed Oct 13, 2017
2 parents 7c7d38b + 117c927 commit 2430a98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libcontainer/rootfs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,12 @@ func pivotRoot(rootfs string) error {
return err
}

// Make oldroot rprivate to make sure our unmounts don't propagate to the
// host (and thus bork the machine).
if err := unix.Mount("", ".", "", unix.MS_PRIVATE|unix.MS_REC, ""); err != nil {
// Make oldroot rslave to make sure our unmounts don't propagate to the
// host (and thus bork the machine). We don't use rprivate because this is
// known to cause issues due to races where we still have a reference to a
// mount while a process in the host namespace are trying to operate on
// something they think has no mounts (devicemapper in particular).
if err := unix.Mount("", ".", "", unix.MS_SLAVE|unix.MS_REC, ""); err != nil {
return err
}
// Preform the unmount. MNT_DETACH allows us to unmount /proc/self/cwd.
Expand Down

0 comments on commit 2430a98

Please sign in to comment.