File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,26 @@ function teardown() {
125125 fi
126126}
127127
128+ # issue: https://github.com/opencontainers/runc/issues/4466
129+ @test " userns join other container userns[selinux enabled]" {
130+ if ! selinuxenabled; then
131+ skip " requires SELinux enabled and in enforcing mode"
132+ fi
133+ # Create a detached container with the id-mapping we want.
134+ update_config ' .process.args = ["sleep", "infinity"]'
135+ runc run -d --console-socket " $CONSOLE_SOCKET " target_userns
136+ [ " $status " -eq 0 ]
137+
138+ # Configure our container to attach to the first container's userns.
139+ target_pid=" $( __runc state target_userns | jq .pid) "
140+ update_config ' .linux.namespaces |= map(if .type == "user" then (.path = "/proc/' " $target_pid " ' /ns/" + .type) else . end)
141+ | del(.linux.uidMappings)
142+ | del(.linux.gidMappings)
143+ | .linux.mountLabel="system_u:object_r:container_file_t:s0:c344,c805"'
144+ runc run -d --console-socket " $CONSOLE_SOCKET " in_userns
145+ [ " $status " -eq 0 ]
146+ }
147+
128148@test " userns join other container userns [bind-mounted nsfd]" {
129149 requires root
130150
You can’t perform that action at this time.
0 commit comments