Skip to content

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

Merged
mrunalp merged 1 commit into
opencontainers:release-1.1from
mrunalp:dont_panic_1.1
Mar 28, 2022
Merged

[release-1.1] libct/cg: IsCgroup2HybridMode: don't panic#3435
mrunalp merged 1 commit into
opencontainers:release-1.1from
mrunalp:dont_panic_1.1

Conversation

@mrunalp
Copy link
Copy Markdown
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
Copy Markdown
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 PR to release-1.1 labels Mar 28, 2022
@kolyshkin kolyshkin self-requested a review March 28, 2022 16:33
Copy link
Copy Markdown
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 PR to release-1.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants