Skip to content

Commit

Permalink
test access stdio in userns container
Browse files Browse the repository at this point in the history
Signed-off-by: lifubang <[email protected]>
  • Loading branch information
lifubang committed Oct 26, 2024
1 parent 9b17259 commit 839fc07
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/integration/userns.bats
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ function teardown() {
fi
}

@test "runc check stdio in userns [terminal=false]" {
update_config ' (.. | select(.terminal? != null)) .terminal |= false
| (.. | select(.[]? == "sh")) += ["-c", "touch /dev/stderr"]'

touch log
__runc create test_busybox >log 2>&1

runc start test_busybox
[ "$status" -eq 0 ]

out=$(cat log)
# We should let stdio could be accessed in user ns container.
# Please see https://github.com/opencontainers/runc/issues/4475
# We should not get error: touch: /dev/stderr: Permission denied.
[[ "$out" = "" ]]

runc kill test_busybox
runc delete test_busybox
}

@test "userns with simple mount" {
update_config ' .process.args += ["-c", "stat /tmp/mount-1/foo.txt"]
| .mounts += [{"source": "source-accessible/dir", "destination": "/tmp/mount-1", "options": ["bind"]}] '
Expand Down

0 comments on commit 839fc07

Please sign in to comment.