[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240127163117.GB13787@redhat.com>
Date: Sat, 27 Jan 2024 17:31:39 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Tycho Andersen <tycho@...ho.pizza>
Cc: Christian Brauner <brauner@...nel.org>, 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
On 01/27, Tycho Andersen wrote:
>
> It seems like (and the current pidfd_test enforces for some cases)
Which pidfd_test ?
> we
> want exactly one notification for a task dying.
This can't be right. EVERY user of poll_wait() or wait_event/etc
must handle/tolerate the false wakeups.
> I don't understand
> how we guarantee this now, with all of these calls.
I don't understand why do we need or even want to guarantee this.
The extra wakeup must be always fine correctness-wise. Sure, it
would be nice to avoid the unnecessary wakeups, and perhaps we
can change wake_up_all() to pass a key to, say, only wake_up the
PIDFD_THREAD waiters from exit_notify(). But certainly this is
outside the scope of PIDFD_THREAD change we discuss.
The changes in do_notify_parent() (I have already sent the patch) and
in exit_notify() (proposed in my previous email) just ensure that,
with the minimal changes, we avoid 2 do_notify_pidfd's from the same
exit_notify() path.
> > exit_notify() is called after exit_files(). pidfd_getfd() returns
> > ESRCH if the exiting thread completes release_task(), otherwise it
> > returns EBADF because ->files == NULL. This too doesn't really
> > depend on PIDFD_THREAD.
>
> Yup, understood. It just seems like an inconsistency we might want to
> fix.
Not sure this worth "fixing"...
Oleg.
Powered by blists - more mailing lists