Skip to content

Commit 07f1df4

Browse files
committed
cri: set default masked/readonly paths to empty paths
Fixes #5029. Signed-off-by: Yohei Ueda <[email protected]>
1 parent af4c55f commit 07f1df4

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

pkg/cri/server/container_create_linux.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ func (c *criService) containerSpec(
195195
specOpts = append(specOpts, customopts.WithMounts(c.os, config, extraMounts, mountLabel), customopts.WithRelabeledContainerMounts(mountLabel))
196196

197197
if !c.config.DisableProcMount {
198+
// Change the default masked/readonly paths to empty slices
199+
// See https://github.com/containerd/containerd/issues/5029
200+
// TODO: Provide an option to set default paths to the ones in oci.populateDefaultUnixSpec()
201+
specOpts = append(specOpts, oci.WithMaskedPaths([]string{}), oci.WithReadonlyPaths([]string{}))
202+
198203
// Apply masked paths if specified.
199204
// If the container is privileged, this will be cleared later on.
200205
if maskedPaths := securityContext.GetMaskedPaths(); maskedPaths != nil {

pkg/cri/server/container_create_linux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,8 @@ func TestMaskedAndReadonlyPaths(t *testing.T) {
11181118
disableProcMount: false,
11191119
masked: nil,
11201120
readonly: nil,
1121-
expectedMasked: defaultSpec.Linux.MaskedPaths,
1122-
expectedReadonly: defaultSpec.Linux.ReadonlyPaths,
1121+
expectedMasked: []string{},
1122+
expectedReadonly: []string{},
11231123
privileged: false,
11241124
},
11251125
"should be able to specify empty paths": {

0 commit comments

Comments
 (0)