runc run: refuse a non-empty cgroup

Commit d08bc0c1b3 ("runc run: warn on non-empty cgroup") introduced
a warning when a container is started in a non-empty cgroup. Such
configuration has lots of issues.

In addition to that, such configuration is not possible at all when
using the systemd cgroup driver.

As planned, let's promote this warning to an error, and fix the test
case accordingly.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2023-03-23 11:57:46 -07:00
parent 1d18743f9e
commit 82bc89cd10
2 changed files with 4 additions and 6 deletions
+3 -3
View File
@@ -356,7 +356,7 @@ function setup() {
[ "$output" = "ok" ]
}
@test "runc run/create should warn about a non-empty cgroup" {
@test "runc run/create should error for a non-empty cgroup" {
[ $EUID -ne 0 ] && requires rootless_cgroup
set_cgroups_path
@@ -366,12 +366,12 @@ function setup() {
# Run a second container sharing the cgroup with the first one.
runc --debug run -d --console-socket "$CONSOLE_SOCKET" ct2
[ "$status" -eq 0 ]
[ "$status" -ne 0 ]
[[ "$output" == *"container's cgroup is not empty"* ]]
# Same but using runc create.
runc create --console-socket "$CONSOLE_SOCKET" ct3
[ "$status" -eq 0 ]
[ "$status" -ne 0 ]
[[ "$output" == *"container's cgroup is not empty"* ]]
}