Skip to content

cgroup: refuse to run in a frozen cgroup - #2243

Merged
giuseppe merged 1 commit into
containers:mainfrom
kolyshkin:cgroup-refuse-frozen
Sep 11, 2026
Merged

giuseppe merged 1 commit into
containers:mainfrom
kolyshkin:cgroup-refuse-frozen

Conversation

@kolyshkin

Copy link
Copy Markdown
Collaborator

If the container cgroup already exists and is frozen, the container process cannot make any progress, and crun run/crun create hangs forever, with no indication of what is going on.

Refuse to use a frozen cgroup, like runc does:

  • with cgroupfs, check it before the container process is put into the cgroup (for cgroup v2, it is created right in it by clone3 with CLONE_INTO_CGROUP, so the check must happen before that);
  • with systemd, the cgroup path is only known after the scope is created, so check it right after that. Check the scope cgroup itself, not the sub-cgroup created by crun inside it, as the latter is not frozen on its own.

The error message is the same as in runc: container's cgroup unexpectedly frozen.

Found by the "runc run/create should refuse pre-existing frozen cgroup" runc integration test (see #2238; the test also needed a fix for systemd, see opencontainers/runc#5455).

If the container cgroup already exists and is frozen, the container
process cannot make any progress, and crun run/create hangs forever,
with no indication of what is going on.

Refuse to use a frozen cgroup, like runc does. With cgroupfs, check it
before the container process is put into the cgroup (for cgroup v2, it
is created right in it by clone3 with CLONE_INTO_CGROUP). With systemd,
the cgroup path is only known after the scope is created, so check it
right after that. Check the scope cgroup itself, not the sub-cgroup
created by crun inside it, as the latter is not frozen on its own.

Found by the "runc run/create should refuse pre-existing frozen cgroup"
runc integration test.

Signed-off-by: Kir Kolyshkin <[email protected]>

@giuseppe giuseppe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@giuseppe
giuseppe merged commit bc240e3 into containers:main Sep 11, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants