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

cgroup-info: check if user.slice is valid before accessing value #11463

Merged

Conversation

flouthoc
Copy link
Collaborator

@flouthoc flouthoc commented Sep 6, 2021

Prevent hitting panic: runtime error: index out of range [1] with length 1
while performingpodman info and we get unexpected values for user.slice.

Prevent hitting `panic: runtime error: index out of range [1] with length 1`
while performing `podman info` when unexpected values for user.slice is found.

[NO TESTS NEEDED]

Signed-off-by: Aditya Rajan <[email protected]>
@mheon
Copy link
Member

mheon commented Sep 7, 2021

Tentative LGTM, but I would really like to know what's going on such that the cgroup path is invalid

@flouthoc
Copy link
Collaborator Author

flouthoc commented Sep 7, 2021

@mheon For this case If user.slice is invalid falls back to getting subsystem details from parent.

@zhangguanzhang
Copy link
Collaborator

zhangguanzhang commented Sep 7, 2021

I think should check it equal to 2 rather than this change

@flouthoc
Copy link
Collaborator Author

flouthoc commented Sep 7, 2021

@zhangguanzhang that should also do the trick.I'll make the change

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM
@giuseppe PTAL

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 7, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 7, 2021
@vrothberg
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 7, 2021
@openshift-merge-robot openshift-merge-robot merged commit e095667 into containers:main Sep 7, 2021
@giuseppe
Copy link
Member

giuseppe commented Sep 7, 2021

given the comment: #11461 (comment)

I am not sure this is the right fix.

Should we skip the line and try with the next one (where the cgroup v2 mount is)?

EDIT: nevermind, it should work as it is

@flouthoc
Copy link
Collaborator Author

flouthoc commented Sep 7, 2021

Just to specify if someone else revisits the thread, loop will start processing another line here if first entry is invalid https://github.com/containers/podman/blob/main/pkg/cgroups/cgroups.go#L231

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants