-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
Wrong userid for process sometimes returned on Linux #970
Comments
Thanks for the detailed report. Interested into sending a fix maybe? |
So turns out on Linux,
|
It should return real UIDs by default. So the current implementation on linux is wrong. The idea was to add methods to get |
Glad we agree. I guess you'd want it to return an |
Yes I'd prefer for the |
While working on this, I realized that I was wrong here. :( FreeBSD impl also returns effective IDs. However, I still think the current API should return real IDs and we add getters for effective IDs. |
Agreed once again. 👍 |
Describe the bug
sysinfo version 0.28.3, platform is Amazon Linux 2 (also reproed on Ubuntu)
sysinfo
always reports a userid ofroot
on Linux for processes with thedumpable
attribute set to a value other than1
. This is because it attempts to get the UID bystat
-ing/proc/[pid]/status
here and picking the owner of that file. The problem with this is that/proc/[pid]/status
isn't always owned by the process's owner. From the docs forproc
:See here for docs on a few scenarios in which this flag can get unset.
Note that the
/proc/[pid]
directory itself is always owned by the process owner, sostat
-ing that instead would be a good alternative.To Reproduce
I put together a small repository with a repro https://github.com/nsunderland1/sysinfo_bug
The meat of it is in
main.rs
https://github.com/nsunderland1/sysinfo_bug/blob/main/src/main.rsThe text was updated successfully, but these errors were encountered: