Skip to content

Commit ec51b46

Browse files
committed
test access stdio in userns container
Signed-off-by: lifubang <[email protected]>
1 parent 02ad8b3 commit ec51b46

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/integration/userns.bats

+20
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ function teardown() {
3636
fi
3737
}
3838

39+
@test "runc check stdio in userns [terminal=false]" {
40+
update_config ' (.. | select(.terminal? != null)) .terminal |= false
41+
| (.. | select(.[]? == "sh")) += ["-c", "touch /dev/stderr"]'
42+
43+
touch log
44+
__runc create test_busybox >log 2>&1
45+
46+
runc start test_busybox
47+
[ "$status" -eq 0 ]
48+
49+
out=$(cat log)
50+
# We should let stdio could be accessed in user ns container.
51+
# Please see https://github.com/opencontainers/runc/issues/4475
52+
# We should not get error: touch: /dev/stderr: Permission denied.
53+
[[ "$out" = "" ]]
54+
55+
runc kill test_busybox
56+
runc delete test_busybox
57+
}
58+
3959
@test "userns with simple mount" {
4060
update_config ' .process.args += ["-c", "stat /tmp/mount-1/foo.txt"]
4161
| .mounts += [{"source": "source-accessible/dir", "destination": "/tmp/mount-1", "options": ["bind"]}] '

0 commit comments

Comments
 (0)