Skip to content

Commit 9233b3d

Browse files
committed
tests/int: test for /dev/null owner regression
Signed-off-by: Kir Kolyshkin <[email protected]> (cherry picked from commit 1bb6209) Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent fa722c1 commit 9233b3d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/integration/exec.bats

+16-1
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,25 @@ function teardown() {
125125

126126
runc exec --user 1000:1000 test_busybox id
127127
[ "$status" -eq 0 ]
128-
129128
[[ "${output}" == "uid=1000 gid=1000"* ]]
130129
}
131130

131+
# https://github.com/opencontainers/runc/issues/3674.
132+
@test "runc exec --user vs /dev/null ownership" {
133+
requires root
134+
135+
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
136+
[ "$status" -eq 0 ]
137+
138+
ls -l /dev/null
139+
__runc exec -d --user 1000:1000 test_busybox id </dev/null
140+
ls -l /dev/null
141+
UG=$(stat -c %u:%g /dev/null)
142+
143+
# Host's /dev/null must be owned by root.
144+
[ "$UG" = "0:0" ]
145+
}
146+
132147
@test "runc exec --additional-gids" {
133148
requires root
134149

0 commit comments

Comments
 (0)