Skip to content

Commit d8844e2

Browse files
committed
tests: integration: add setgid mkdirall test
Signed-off-by: Aleksa Sarai <[email protected]>
1 parent 066b109 commit d8844e2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/integration/mounts.bats

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,29 @@ function test_mount_order() {
211211
[[ "$output" == *"must be mounted on ordinary directory"* ]]
212212
}
213213

214+
# https://github.com/opencontainers/runc/issues/4401
215+
@test "runc run [setgid / + mkdirall]" {
216+
mkdir rootfs/setgid
217+
chmod '=7755' rootfs/setgid
218+
219+
update_config '.mounts += [{
220+
type: "tmpfs",
221+
source: "tmpfs",
222+
destination: "/setgid/a/b/c",
223+
options: ["ro", "nodev", "nosuid"]
224+
}]'
225+
update_config '.process.args |= ["true"]'
226+
227+
runc run test_busybox
228+
[ "$status" -eq 0 ]
229+
230+
# Verify that the setgid bit is inherited.
231+
[[ "$(stat -c %a rootfs/setgid)" == 7755 ]]
232+
[[ "$(stat -c %a rootfs/setgid/a)" == 2755 ]]
233+
[[ "$(stat -c %a rootfs/setgid/a/b)" == 2755 ]]
234+
[[ "$(stat -c %a rootfs/setgid/a/b/c)" == 2755 ]]
235+
}
236+
214237
@test "runc run [ro /sys/fs/cgroup mounts]" {
215238
# Without cgroup namespace.
216239
update_config '.linux.namespaces -= [{"type": "cgroup"}]'

0 commit comments

Comments
 (0)