From: Tycho Andersen <tycho@tycho.pizza>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Christian Brauner <brauner@kernel.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] pidfd: implement PIDFD_THREAD flag for pidfd_open()
Date: Tue, 30 Jan 2024 19:27:50 -0700 [thread overview]
Message-ID: <ZbmwJiIS4ei64u6R@tycho.pizza> (raw)
In-Reply-To: <20240130113409.GA29849@redhat.com>
On Tue, Jan 30, 2024 at 12:34:09PM +0100, Oleg Nesterov wrote:
> Damn. Self-NACK.
>
> I forgot (we all ;) about mt-exec, and there are 2 problems.
>
> 1. The "if (!thread_group_leader(tsk))" block in de_thread() needs
> do_notify_pidfd() too, the execing non-leader thread looses its
> old pid, pidfd_poll(PIDFD_THREAD, pid-of-execing-sub-thread)
> should succeed. Must be fixed, I think.
I think the `test_non_tgl_exec` from my tests exercises the scenario
you're describing, and it works.
> 2. pidfd_poll(PIDFD_THREAD, pid-of-group-leader) should not succeed
> when its sub-thread execs, the execing thread inherits the leader's
> pid. Perhaps pidfd_task_exited() can check sig->group_exec_task,
I didn't have an explicit test for this, but I hacked one up, and
pidfd_poll(PIDFD_THREAD, pid-of-group-leader) doesn't return after
exec.
I think it's ok? But I must be missing something.
Tycho
next prev parent reply other threads:[~2024-01-31 2:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 11:26 [PATCH v2] pidfd: implement PIDFD_THREAD flag for pidfd_open() Oleg Nesterov
2024-01-30 11:34 ` Oleg Nesterov
2024-01-31 2:27 ` Tycho Andersen [this message]
2024-01-31 13:52 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZbmwJiIS4ei64u6R@tycho.pizza \
--to=tycho@tycho.pizza \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox