Messages in this thread | | | Date | Fri, 1 Apr 2022 09:09:42 +0200 | From | Christian Brauner <> | Subject | Re: [PATCH] pid: Allow creation of pidfds to threads |
| |
On Thu, Mar 31, 2022 at 09:02:32PM +0200, Alois Wohlschlager wrote: > The pidfd_open() syscall now allows retrieving pidfds to processes which > are not thread group leaders. Like standard pidfds so far, these may be > used to retrieve file descriptors from the target thread using > pidfd_getfd(), as well as for killing the target thread group using > pidfd_send_signal(). > However, unlike pidfds referencing thread group leaders, they do not > support polling for process exit. Attempts to do so signal an error > condition instead of blocking indefinitely. > > Since the semantics of pidfd_getfd() and pidfd_send_signal() are not > very useful within a thread group, these thread pidfds can only be > created using pidfd_open(), not via clone(). > > Signed-off-by: Alois Wohlschlager <alois1@gmx-topmail.de> > ---
Hey Alois,
We originally blocked this because it is not as easy as simply allowing pidfds to be created for non-thread-group leaders. For a start, pidfd_poll() currently doens't work if pidfd_task() isn't a thread-group leader and you'll just hang for CLONE_PIDFD | CLONE_THREAD. So at least that needs to be adapated as well and there's likely a bunch of other corner-cases I'm forgetting about. Do you have a concrete use-case you want this for?
Christian
| |