Skip to content

Commit 70b16a5

Browse files
committed
Remove check for binding to /
In order to mount root filesystems inside the container's mount namespace as part of the spec we need to have the ability to do a bind mount to / as the destination. Signed-off-by: Michael Crosby <[email protected]>
1 parent 3d77778 commit 70b16a5

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

libcontainer/rootfs_linux.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,6 @@ func getCgroupMounts(m *configs.Mount) ([]*configs.Mount, error) {
306306
// checkMountDestination checks to ensure that the mount destination is not over the top of /proc.
307307
// dest is required to be an abs path and have any symlinks resolved before calling this function.
308308
func checkMountDestination(rootfs, dest string) error {
309-
if libcontainerUtils.CleanPath(rootfs) == libcontainerUtils.CleanPath(dest) {
310-
return fmt.Errorf("mounting into / is prohibited")
311-
}
312309
invalidDestinations := []string{
313310
"/proc",
314311
}

libcontainer/rootfs_linux_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ func TestCheckMountDestFalsePositive(t *testing.T) {
3232
}
3333
}
3434

35-
func TestCheckMountRoot(t *testing.T) {
36-
dest := "/rootfs"
37-
err := checkMountDestination("/rootfs", dest)
38-
if err == nil {
39-
t.Fatal(err)
40-
}
41-
}
42-
4335
func TestNeedsSetupDev(t *testing.T) {
4436
config := &configs.Config{
4537
Mounts: []*configs.Mount{

0 commit comments

Comments
 (0)