Support profiling of chrooted processes
- Dominant language
- Python
- Stars
- 826
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
gProfiler makes wide use of `/proc/pid/root` to access files in the mount namespace of processes.
If a process is chrooted, its `/proc/pid/root` behaves somewhat differently, breaking our usage. See my note from [this py-spy PR](https://github.com/benfred/py-spy/pull/562):
> My understanding is that /proc/pid/root points to the root as the process sees it, while /proc/pid/maps give us paths as WE see it. We (py-spy) are not chrooted when py-spy runs outside the chroot, so we need to strip the chroot from the /proc/pid/maps value. As a generalization, we always strip the path, which in most cases is just / if the process is not chrooted.
* [ ] Python: this affects py-spy which we'll need to upgrade after https://github.com/benfred/py-spy/pull/562.
* [ ] Ruby: I assume rbspy is affected as well and will require a similar fix.
* [ ] Java: async-profiler itself is not affected, but our driver for async-profiler (`java.py`) is.
* [ ] perf: I think will handle but we need to test if we care about this case.
Keywords: chrooted chroot
Contributor guide
Assessment
This issue has not been assessed yet.