CRI: change the /dev/shm mount options in Sandbox.
All containers except the pause container, mount `/dev/shm" with flags `nosuid,nodev,noexec`. So change mount options for pause container to keep consistence. This also helps to solve issues of failing to mount `/dev/shm` when pod/container level user namespace is enabled. Fixes: #6911 Signed-off-by: Jiang Liu <gerry@linux.alibaba.com> Signed-off-by: Lei Wang <wllenyj@linux.alibaba.com>
This commit is contained in:
parent
a62a95789c
commit
42a386c816
@ -103,12 +103,15 @@ func (c *criService) sandboxContainerSpec(id string, config *runtime.PodSandboxC
|
||||
}
|
||||
// Remove the default /dev/shm mount from defaultMounts, it is added in oci/mounts.go.
|
||||
specOpts = append(specOpts, oci.WithoutMounts(devShm))
|
||||
// In future the when user-namespace is enabled, the `nosuid, nodev, noexec` flags are
|
||||
// required, otherwise the remount will fail with EPERM. Just use them unconditionally,
|
||||
// they are nice to have anyways.
|
||||
specOpts = append(specOpts, oci.WithMounts([]runtimespec.Mount{
|
||||
{
|
||||
Source: sandboxDevShm,
|
||||
Destination: devShm,
|
||||
Type: "bind",
|
||||
Options: []string{"rbind", "ro"},
|
||||
Options: []string{"rbind", "ro", "nosuid", "nodev", "noexec"},
|
||||
},
|
||||
// Add resolv.conf for katacontainers to setup the DNS of pod VM properly.
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user