Thread (42 messages) 42 messages, 9 authors, 2019-03-26

Re: [PATCH 0/4] pid: add pidctl()

From: Jonathan Kowalski <hidden>
Date: 2019-03-25 21:55:16
Also in: lkml

On Mon, Mar 25, 2019 at 9:43 PM Joel Fernandes [off-list ref] wrote:
On Mon, Mar 25, 2019 at 10:19:26PM +0100, Jann Horn wrote:
quoted
On Mon, Mar 25, 2019 at 10:11 PM Joel Fernandes [off-list ref] wrote:

But often you don't just want to wait for a single thing to happen;
you want to wait for many things at once, and react as soon as any one
of them happens. This is why the kernel has epoll and all the other
"wait for event on FD" APIs. If waiting for a process isn't possible
with fd-based APIs like epoll, users of this API have to spin up
useless helper threads.
This is true. I almost forgot about the polling requirement, sorry. So then a
new syscall it is.. About what to wait for, that can be a separate parameter
to pidfd_wait then.
This introduces a time window where the process changes state between
"get pidfd" and "setup waitfd", it would be simpler if the pidfd
itself supported .poll and on termination the exit status was made
readable from the file descriptor.

Further, in the clone4 patchset, there was a mechanism to autoreap
such a process so that it does not interfere with waiting a process
does normally. How do you intend to handle this case if anyone except
the parent is wanting to *wait* on the process (a second process,
without reaping, so as to not disrupt any waiting in the parent), and
for things like libraries that finally can manage their own set of
process when pidfd_clone is added, by excluding this process from the
process's normal wait handling logic.

Moreover, should anyone except the parent process be allowed to open a
readable pidfd (or waitfd), without additional capabilities?
Thanks.

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