Skip to content

Commit

Permalink
Merge pull request #5070 from yoheiueda/empty-masked
Browse files Browse the repository at this point in the history
cri: set default masked/readonly paths to empty paths
  • Loading branch information
estesp committed Feb 25, 2021
2 parents c61f0ce + 07f1df4 commit 8dbe53a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/cri/server/container_create_linux.go
Expand Up @@ -195,6 +195,11 @@ func (c *criService) containerSpec(
specOpts = append(specOpts, customopts.WithMounts(c.os, config, extraMounts, mountLabel), customopts.WithRelabeledContainerMounts(mountLabel))

if !c.config.DisableProcMount {
// Change the default masked/readonly paths to empty slices
// See https://github.com/containerd/containerd/issues/5029
// TODO: Provide an option to set default paths to the ones in oci.populateDefaultUnixSpec()
specOpts = append(specOpts, oci.WithMaskedPaths([]string{}), oci.WithReadonlyPaths([]string{}))

// Apply masked paths if specified.
// If the container is privileged, this will be cleared later on.
if maskedPaths := securityContext.GetMaskedPaths(); maskedPaths != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cri/server/container_create_linux_test.go
Expand Up @@ -1118,8 +1118,8 @@ func TestMaskedAndReadonlyPaths(t *testing.T) {
disableProcMount: false,
masked: nil,
readonly: nil,
expectedMasked: defaultSpec.Linux.MaskedPaths,
expectedReadonly: defaultSpec.Linux.ReadonlyPaths,
expectedMasked: []string{},
expectedReadonly: []string{},
privileged: false,
},
"should be able to specify empty paths": {
Expand Down

0 comments on commit 8dbe53a

Please sign in to comment.