Thread (8 messages) 8 messages, 3 authors, 2021-10-13

Re: [RFC PATCH] userfaultfd: support control over mm of remote PIDs

From: Nadav Amit <hidden>
Date: 2021-09-27 10:19:45
Also in: lkml

On Sep 27, 2021, at 2:29 AM, David Hildenbrand [off-list ref] wrote:

On 26.09.21 19:06, Nadav Amit wrote:
quoted
From: Nadav Amit <redacted>
Non-cooperative mode is useful but only for forked processes.
Userfaultfd can be useful to monitor, debug and manage memory of remote
processes.
To support this mode, add a new flag, UFFD_REMOTE_PID, and an optional
second argument to the userfaultfd syscall. When the flag is set, the
second argument is assumed to be the PID of the process that is to be
monitored. Otherwise the flag is ignored.
The syscall enforces that the caller has CAP_SYS_PTRACE to prevent
misuse of this feature.
What supposed to happen if the target process intents to use uffd itself?
Thanks for the quick response.

First, sorry that I mistakenly dropped the changes to userfaultfd.h
that define UFFD_REMOTE_PID.

As for your question: there are standard ways to deal with such cases,
similarly to when a debugged program wants to use PTRACE. One way is
to block the userfaultfd syscall, using seccomp. Another way is to do
chaining using ptrace (although using ptrace for anything is
challenging).

It is also possible to add tailor something specific to userfaultfd,
but I think seccomp is a good enough solution. I am open to suggestions.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help