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

Fix procfs when reading cgroup membership #8106

Closed
wants to merge 1 commit into from

Conversation

brianc118
Copy link
Contributor

When reading cgroup membership, we currently assume that the cgroup v2
line will be first in /proc/[pid]/cgroup. This is not necessarily the
case. Instead let's take the first line that starts with "0::".

Tested on ubuntu where

$ cat /proc/1/cgroup
12:blkio:/init.scope
11:pids:/init.scope
8:memory:/init.scope
7:freezer:/
4:devices:/init.scope
2:cpu,cpuacct:/init.scope
1:name=systemd:/init.scope
0::/init.scope

This should fix #8105.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 22, 2021
@facebook-github-bot
Copy link
Contributor

@brianc118 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

When reading cgroup membership, we currently assume that the cgroup v2
line will be first in /proc/[pid]/cgroup. This is not necessarily the
case. Instead let's take the first line that starts with "0::".

Tested on ubuntu where

```
$ cat /proc/1/cgroup
12:blkio:/init.scope
11:pids:/init.scope
8:memory:/init.scope
7:freezer:/
4:devices:/init.scope
2:cpu,cpuacct:/init.scope
1:name=systemd:/init.scope
0::/init.scope
```
@facebook-github-bot
Copy link
Contributor

@brianc118 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@brianc118 merged this pull request in c3af8c1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid file format: "/proc/1/cgroup"
2 participants