-
Notifications
You must be signed in to change notification settings - Fork 33
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
Use prctl when ptrace is restricted #979
Comments
looks great |
AFAIK |
What about file and devdax providers? Do they use just a file path? Anyway, we have to implement it to improve the situation on Ubuntu for OS and L0 providers. The MPI and oneCCL are mostly interesting for L0 flow. |
In case of any questions regarding implementation, @nikitaxgusev might be a good contact to answer questions as he already implemented it in oneCCL. |
Rationale
Today, most UMF's memory providers (all except CUDA provider) on Linux use the
pidfd_getfd(2)
system call to obtain a duplicate of another process's file descriptor. The ptrace governs permission to duplicate another process's file descriptor.Today UMF requires the
/proc/sys/kernel/yama/ptrace_scope
to be0
. Otherwise, thepidfd_getfd
fails. It is a significant limitation because on Ubuntu the/proc/sys/kernel/yama/ptrace_scope
is1
("restricted ptrace") by default and some UMF users might have no permission to change it.Description
The
PR_SET_PTRACER
allows other processes to ptrace(2) the calling process (see man page for details). The idea is that the process that creates the IPC handle (callsumfGetIPCHandle
) can call theint prctl(PR_SET_PTRACER, long pid);
syscall to allow other processes toptrace
the current process when the/proc/sys/kernel/yama/ptrace_scope
is1
.The oneCCL already employs that for the L0 backend, Intel MPI will introduce it soon. We should use this mechanism as well.
API Changes
No API changes. Only implementation should be updated
Implementation details
int prctl(PR_SET_PTRACER, long pid);
syscall should called once per process. We can do it in the UMF init or we can do it lazily at first access to IPC functionality.getppid()
) to allow only processes with the same parent (MPI/oneCCL ranks have the same parent:mpirun
) to ptrace the current process. UMF can use the same approach and provide an environment variable to tweak that and allow all processes to ptrace the current process.How to test
Set the
/proc/sys/kernel/yama/ptrace_scope
to1
and run IPC tests.Meta
PR_SET_PTRACER
The text was updated successfully, but these errors were encountered: