Skip to content

Commit e8d8ae3

Browse files
committed
cri: selinux relabel /dev/shm
Address an issue originally seen in the k3s 1.3 and 1.4 forks of containerd/cri, k3s-io/k3s#2240 Even with updated container-selinux policy, container-local /dev/shm will get mounted with container_runtime_tmpfs_t because it is a tmpfs created by the runtime and not the container (thus, container_runtime_t transition rules apply). The relabel mitigates such, allowing envoy proxy to work correctly (and other programs that wish to write to their /dev/shm) under selinux. Tested locally with: - SELINUX=Enforcing vagrant up --provision-with=shell,selinux,test-integration - SELINUX=Enforcing CRITEST_ARGS=--ginkgo.skip='HostIpc is true' vagrant up --provision-with=shell,selinux,test-cri - SELINUX=Permissive CRITEST_ARGS=--ginkgo.focus='HostIpc is true' vagrant up --provision-with=shell,selinux,test-cri Signed-off-by: Jacob Blain Christen <[email protected]>
1 parent ac61e58 commit e8d8ae3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

pkg/cri/server/container_create_linux.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ func (c *criService) containerMounts(sandboxID string, config *runtime.Container
9999
sandboxDevShm = devShm
100100
}
101101
mounts = append(mounts, &runtime.Mount{
102-
ContainerPath: devShm,
103-
HostPath: sandboxDevShm,
104-
Readonly: false,
102+
ContainerPath: devShm,
103+
HostPath: sandboxDevShm,
104+
Readonly: false,
105+
SelinuxRelabel: true,
105106
})
106107
}
107108
return mounts

0 commit comments

Comments
 (0)