Skip to content

fs2: thaw the cgroup if freezing fails - #108

Merged
thaJeztah merged 1 commit into
opencontainers:mainfrom
kolyshkin:fs2-thaw-on-freeze-fail
Dec 4, 2026
Merged

thaJeztah merged 1 commit into
opencontainers:mainfrom
kolyshkin:fs2-thaw-on-freeze-fail

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

Freezing a cgroup v2 can time out: a task in an uninterruptible or killable sleep (e.g. waiting for a FUSE or NFS reply) does not reach the freezer trap, so the cgroup never becomes frozen. cgroup.freeze then stays set to 1, and every subsequent getFreezer call fails with the same 10s freeze timeout. For runc this means pause fails, and then state, resume, exec, kill and delete --force all fail too, until the blocked task wakes up.

This thaws the cgroup back if freezing failed, as the cgroup v1 freezer already does.

Reproduced on Fedora 45 (kernel 7.2.11, cgroup v2) by bind-mounting a fuse-overlayfs mount into a container, stopping the FUSE daemon with SIGSTOP, and running stat on that mount inside the container before runc pause. Without this fix, every command after pause fails after 10s. With it, the container stays running and all commands work.

Supersedes opencontainers/runc#5650.

Found by oss-scanner: ANT-2026-AJESWKFI

@kolyshkin

Copy link
Copy Markdown
Contributor Author

I had an impression that cgroup v2 can't fail on us like that and this is why I haven't added that kind of fix (which is currently only present in cgroup v1). Apparently it can.

@kolyshkin kolyshkin added this to the 0.1.2 milestone Dec 3, 2026
Comment thread fs2/freezer.go Outdated
)

func setFreezer(dirPath string, state cgroups.FreezerState) error {
func setFreezer(dirPath string, state cgroups.FreezerState) (Err error) {

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.

nit; can you use retErr instead of Err (I think that's what we use in most / various other places)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed (I remember though that @cyphar usually uses Err in such cases, so we might have a few in this repo).

Comment thread fs2/freezer.go Outdated
defer func() {
if Err != nil {
// Freezing failed (most probably timed out, as some
// tasks in the cgroup can't be frozen while in an

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.

wondering if the comment here is a bit too much; also because of the various assumptions around causes described

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right; my AI friends are a bit too talkative. Fixed.

Freezing a cgroup v2 can time out: a task in an uninterruptible or
killable sleep (e.g. waiting for a FUSE or NFS reply) does not reach the
freezer trap, so the cgroup does not become frozen. In this case
cgroup.freeze stays set to 1 and the cgroup is left in the freezing
state.

As a result, every subsequent getFreezer call (and thus every runc
command which needs the container state, including resume, exec, kill
and delete --force) fails with the same freeze timeout until the
blocked task wakes up.

Thaw the cgroup back if freezing failed, as cgroup v1 freezer already
does.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
kolyshkin force-pushed the fs2-thaw-on-freeze-fail branch from bd93310 to 577a366 Compare December 3, 2026 06:58

@thaJeztah thaJeztah 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, thx!

@thaJeztah
thaJeztah added this pull request to the merge queue Dec 4, 2026
Merged via the queue into opencontainers:main with commit a6a9e35 Dec 4, 2026
19 of 22 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.

3 participants