From 83137c6884a4838ae03baa8b7f311729cc93c285 Mon Sep 17 00:00:00 2001 From: lifubang Date: Thu, 3 Aug 2023 08:46:37 +0800 Subject: [PATCH] add a test case about missing stricky bit Signed-off-by: lifubang --- tests/integration/run.bats | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/integration/run.bats b/tests/integration/run.bats index 8afc4bbe860..9f1f1d8bc74 100644 --- a/tests/integration/run.bats +++ b/tests/integration/run.bats @@ -77,6 +77,22 @@ function teardown() { [[ "${lines[0]}" == *'mydomainname'* ]] } +# https://github.com/opencontainers/runc/issues/3952 +@test "runc run with tmpfs" { + requires root + + chmod 'a=rwx,ug+s,+t' rootfs/tmp # set all bits + mode=$(stat -c %A rootfs/tmp) + + # shellcheck disable=SC2016 + update_config '.process.args = ["sh", "-c", "stat -c %A /tmp"]' + update_config '.mounts += [{"destination": "/tmp", "type": "tmpfs", "source": "tmpfs", "options":["noexec","nosuid","nodev","rprivate"]}]' + + runc run test_tmpfs + [ "$status" -eq 0 ] + [ "$output" = "$mode" ] +} + @test "runc run with tmpfs perms" { # shellcheck disable=SC2016 update_config '.process.args = ["sh", "-c", "stat -c %a /tmp/test"]'