Parse /proc/pid/status "Groups" field as u32#334
Merged
eminence merged 1 commit intoeminence:masterfrom Feb 8, 2025
Merged
Conversation
Groups are gid_t which is unsigned.
c88277b to
2233ed3
Compare
Owner
|
Nice find, thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Groupsis printed as unsigned:https://github.com/torvalds/linux/blob/5c8c229261f14159b54b9a32f12e5fa89d88b905/fs/proc/array.c#L199-L203
I got an error like this:
(procfs/procfs-core 0.17.0)
I suspect it's the
Groups, other users ofparse_listareNStgidNSpidNSpgidNSsid(which are also printed unsigned...) but the kernel limits them to 1 billion per the docs here: https://github.com/torvalds/linux/blob/5c8c229261f14159b54b9a32f12e5fa89d88b905/include/linux/threads.h#L30-L35 so it's safe to assume the issue I observed is fromGroups, and we don't need to change their type (pid_tis truly signed).Here's is a small reproducer program:
proc.status()on this PID fails on master and works on this PR.