Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Explicitly set rw for privileged container.
Browse files Browse the repository at this point in the history
Signed-off-by: Lantao Liu <lantaol@google.com>
  • Loading branch information
Random-Liu committed May 7, 2018
1 parent 5f4035a commit a5d1332
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func clearReadOnly(m *runtimespec.Mount) {
opt = append(opt, o)
}
}
m.Options = opt
m.Options = append(opt, "rw")
}

// addDevices set device mapping without privilege.
Expand Down
8 changes: 4 additions & 4 deletions pkg/server/container_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,14 +627,14 @@ func TestPrivilegedBindMount(t *testing.T) {
}
spec := g.Spec()
if test.expectedSysFSRO {
checkMount(t, spec.Mounts, "sysfs", "/sys", "sysfs", []string{"ro"}, nil)
checkMount(t, spec.Mounts, "sysfs", "/sys", "sysfs", []string{"ro"}, []string{"rw"})
} else {
checkMount(t, spec.Mounts, "sysfs", "/sys", "sysfs", nil, []string{"ro"})
checkMount(t, spec.Mounts, "sysfs", "/sys", "sysfs", []string{"rw"}, []string{"ro"})
}
if test.expectedCgroupFSRO {
checkMount(t, spec.Mounts, "cgroup", "/sys/fs/cgroup", "cgroup", []string{"ro"}, nil)
checkMount(t, spec.Mounts, "cgroup", "/sys/fs/cgroup", "cgroup", []string{"ro"}, []string{"rw"})
} else {
checkMount(t, spec.Mounts, "cgroup", "/sys/fs/cgroup", "cgroup", nil, []string{"ro"})
checkMount(t, spec.Mounts, "cgroup", "/sys/fs/cgroup", "cgroup", []string{"rw"}, []string{"ro"})
}
}
}
Expand Down

0 comments on commit a5d1332

Please sign in to comment.