[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240125-tricksen-baugrube-3f78c487a23a@brauner>
Date: Thu, 25 Jan 2024 18:17:29 +0100
From: Christian Brauner <brauner@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Tycho Andersen <tycho@...ho.pizza>, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org, Tycho Andersen <tandersen@...flix.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH v3 1/3] pidfd: allow pidfd_open() on non-thread-group
leaders
> > When it is reaped is "mostly unrelated".
>
> Then why pidfd_poll() can't simply check !task || task->exit_state ?
>
> Nevermind. So, currently pidfd_poll() succeeds when the leader can be
Hm, the comment right above mentions:
/*
* Inform pollers only when the whole thread group exits.
* If the thread group leader exits before all other threads in the
* group, then poll(2) should block, similar to the wait(2) family.
*/
> reaped, iow the whole thread group has exited. But even if you are the
> parent, you can't expect that wait(WNOHANG) must succeed, the leader
> can be traced. I guess it is too late to change this behaviour.
Hm, why is that an issue though? And if it is an issue why shouldn't we
be able to change it? Because a program would rely on WNOHANG to hang on
a ptraced leader? That seems esoteric imho. I might just misunderstand.
>
> What if we add the new PIDFD_THREAD flag? With this flag
>
> - sys_pidfd_open() doesn't require the must be a group leader
Yes.
>
> - pidfd_poll() succeeds when the task passes exit_notify() and
> becomes a zombie, even if it is a leader and has other threads.
Iiuc, if an existing user creates a pidfd for a thread-group leader and
then polls that pidfd they would currently only get notified if the
thread-group is empty and the leader has exited.
If we now start notifying when the thread-group leader exits but the
thread-group isn't empty then this would be a fairly big api change and
I would expect this to cause regressions as that surely is something
that userspace relies on. Am I understand this right?
Powered by blists - more mailing lists