mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct: Signal: honor RootlessCgroups
`signalAllProcesses()` depends on the cgroup and is expected to fail when runc is running in rootless without an access to the cgroup. When `RootlessCgroups` is set to `true`, runc just ignores the error from `signalAllProcesses` and may leak some processes running. (See the comments in PR 4395) In the future, runc should walk the process tree to avoid such a leak. Note that `RootlessCgroups` is a misnomer; it is set to `false` despite the name when cgroup v2 delegation is configured. This is expected to be renamed in a separate commit. Fix issue 4394 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
@@ -133,3 +133,27 @@ test_host_pidns_kill() {
|
||||
test_host_pidns_kill
|
||||
unset KILL_INIT
|
||||
}
|
||||
|
||||
# https://github.com/opencontainers/runc/issues/4394 (cgroup v1, rootless)
|
||||
@test "kill KILL [shared pidns]" {
|
||||
update_config '.process.args = ["sleep", "infinity"]'
|
||||
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" target_ctr
|
||||
[ "$status" -eq 0 ]
|
||||
testcontainer target_ctr running
|
||||
target_pid="$(__runc state target_ctr | jq .pid)"
|
||||
update_config '.linux.namespaces |= map(if .type == "user" or .type == "pid" then (.path = "/proc/'"$target_pid"'/ns/" + .type) else . end) | del(.linux.uidMappings) | del(.linux.gidMappings)'
|
||||
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" attached_ctr
|
||||
[ "$status" -eq 0 ]
|
||||
testcontainer attached_ctr running
|
||||
|
||||
runc kill attached_ctr 9
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
runc delete --force attached_ctr
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
runc delete --force target_ctr
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user