Skip to content

Commit 8efb17c

Browse files
authored
Merge pull request #4705 from dweomer/selinx-relabel-dev-shm-but-not-with-hostipc
cri: selinuxrelabel=false for /dev/shm w/ host ipc
2 parents cc3785c + a1e7dd9 commit 8efb17c

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

pkg/cri/server/container_create_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (c *criService) containerMounts(sandboxID string, config *runtime.Container
102102
ContainerPath: devShm,
103103
HostPath: sandboxDevShm,
104104
Readonly: false,
105-
SelinuxRelabel: true,
105+
SelinuxRelabel: sandboxDevShm != devShm,
106106
})
107107
}
108108
return mounts

pkg/cri/server/container_create_linux_test.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,10 @@ func TestContainerMounts(t *testing.T) {
455455
Readonly: true,
456456
},
457457
{
458-
ContainerPath: "/dev/shm",
459-
HostPath: filepath.Join(testStateDir, sandboxesDir, testSandboxID, "shm"),
460-
Readonly: false,
458+
ContainerPath: "/dev/shm",
459+
HostPath: filepath.Join(testStateDir, sandboxesDir, testSandboxID, "shm"),
460+
Readonly: false,
461+
SelinuxRelabel: true,
461462
},
462463
},
463464
},
@@ -480,9 +481,10 @@ func TestContainerMounts(t *testing.T) {
480481
Readonly: false,
481482
},
482483
{
483-
ContainerPath: "/dev/shm",
484-
HostPath: filepath.Join(testStateDir, sandboxesDir, testSandboxID, "shm"),
485-
Readonly: false,
484+
ContainerPath: "/dev/shm",
485+
HostPath: filepath.Join(testStateDir, sandboxesDir, testSandboxID, "shm"),
486+
Readonly: false,
487+
SelinuxRelabel: true,
486488
},
487489
},
488490
},
@@ -553,9 +555,10 @@ func TestContainerMounts(t *testing.T) {
553555
Readonly: false,
554556
},
555557
{
556-
ContainerPath: "/dev/shm",
557-
HostPath: filepath.Join(testStateDir, sandboxesDir, testSandboxID, "shm"),
558-
Readonly: false,
558+
ContainerPath: "/dev/shm",
559+
HostPath: filepath.Join(testStateDir, sandboxesDir, testSandboxID, "shm"),
560+
Readonly: false,
561+
SelinuxRelabel: true,
559562
},
560563
},
561564
},

0 commit comments

Comments
 (0)