Re: [PATCH 2/3] pidfd_open.2: add PIDFD_THREAD and poll nuances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 9, 2024 at 2:43 AM Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> Hi Kir,
>
> On 07/08, Kir Kolyshkin wrote:
> >
> > [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=64bef697d33b
>
> The changelog says:
>
>     pidfd: implement PIDFD_THREAD flag for pidfd_open()
>
>     With this flag:
>
>             - pidfd_open() doesn't require that the target task must be
>               a thread-group leader
>
>             - pidfd_poll() succeeds when the task exits and becomes a
>               zombie (iow, passes exit_notify()), even if it is a leader
>               and thread-group is not empty.
>
>               This means that the behaviour of pidfd_poll(PIDFD_THREAD,
>               pid-of-group-leader) is not well defined if it races with
>               exec() from its sub-thread; pidfd_poll() can succeed or not
>               depending on whether pidfd_task_exited() is called before
>               or after exchange_tids().
>
> > +The behavior depends on whether the file descriptor refers
> > +to a process (thread-group leader) or a thread (see
> > +.B PIDFD_THREAD
> > +above):
> > +.RS
> > +.IP \[bu] 3
> > +For a thread-group leader, the polling task is woken if the
> > +thread-group is empty. In other words, if the thread-group
> > +leader task exits when there are still threads alive in its
> > +thread-group, the polling task will not be woken when the
> > +thread-group leader exits, but rather when the last thread in the
> > +thread-group exits.
>
> so this part is not accurate.

I copied the above text almost verbatim from the merge commit
description (commit b5683a37c881).

Until it's clarified, let's remove this text, adding a TODO instead.

>
> See also 43f0df54c96fa5a ("pidfd_poll: report POLLHUP when pid_task() == NULL")
> which adds another feature.
>
> Oleg.
>





[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux