-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added run_in_ns_wrapper to only run in namespace when root is detected. #265
Conversation
…. Simplified run_in_ns_wrapper and removed it from proc_events.
I added a new commit that addresses your comments. Biggest change is moving is_root into granulate-utils. Is ns.py the right place to add it? That's where it gets used. |
Wouldn't create another file just for this and I don't think any other file fits better. Leave it like this. |
@pcarella1 When it's ready please also move to ready to review so CI will run and we'll see tests. |
This PR adds support for running gprofiler without root/sudo as discussed in issue 905 in the gprofiler repo: intel/gprofiler#905.
It creates run_in_ns_wrapper function which bypasses the code to enter name spaces when not root (as we assume we're always in the correct namespace for the processes being profiled).
This commit is required for PR 936 in the gprofiler repo intel/gprofiler#936.
I have tested this on x86 using scripts/build_x86_64_executable.sh script. Centos 9 Stream w/ kernel 6.6, though with some limitations mentioned in the gprofiler PR.
The code is linted.
One issue is when running on one system, I receive the below warning (though gprofiler completes and produces valid results)
Issue seems to be that this bind call in the threading library requires root. Is this because the read we're trying to bind to is owned by root or does the function just inherently require root? I haven't been able to diagnose this.
https://github.com/Granulate/granulate-utils/blob/0cb9b70f4eda85f0a14e86ec41ecc7b57a133755/granulate_utils/linux/proc_events.py#L222