Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.1] libct/cg: IsCgroup2HybridMode: don't panic #3435

Merged
merged 1 commit into from Mar 28, 2022

Conversation

mrunalp
Copy link
Contributor

@mrunalp mrunalp commented Mar 28, 2022

This is a backport of #3433 to 1.1


In case statfs("/sys/fs/cgroup/unified") fails with any error other
than ENOENT, current code panics. As IsCgroup2HybridMode is called from
libcontainer/cgroups/fs's init function, this means that any user of
libcontainer may panic during initialization, which is ugly.

Avoid panicking; instead, do not enable hybrid hierarchy support and
report the error (under debug level, not to confuse anyone).

Basically, replace the panic with "turn off hybrid mode support"
(which makes total sense since we were unable to statfs its root).

Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com

In case statfs("/sys/fs/cgroup/unified") fails with any error other
than ENOENT, current code panics. As IsCgroup2HybridMode is called from
libcontainer/cgroups/fs's init function, this means that any user of
libcontainer may panic during initialization, which is ugly.

Avoid panicking; instead, do not enable hybrid hierarchy support and
report the error (under debug level, not to confuse anyone).

Basically, replace the panic with "turn off hybrid mode support"
(which makes total sense since we were unable to statfs its root).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@mrunalp
Copy link
Contributor Author

mrunalp commented Mar 28, 2022

@AkihiroSuda @thaJeztah @kolyshkin I picked this into 1.1 so we could tag a release there to vendor into k8s.

cc: @liggitt

@kolyshkin kolyshkin added area/cgroupv1 backport/1.1-pr A backport to 1.1.x release. labels Mar 28, 2022
@kolyshkin kolyshkin self-requested a review March 28, 2022 16:33
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

@mrunalp mrunalp merged commit 6bf0a56 into opencontainers:release-1.1 Mar 28, 2022
This was referenced Mar 28, 2022
@kolyshkin kolyshkin added this to the 1.1.1 milestone Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cgroupv1 backport/1.1-pr A backport to 1.1.x release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants