linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Christian Brauner <brauner@kernel.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Tycho Andersen <tycho@tycho.pizza>,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pidfd: change pidfd_send_signal() to respect PIDFD_THREAD
Date: Thu, 8 Feb 2024 16:57:31 +0100	[thread overview]
Message-ID: <20240208155731.GH19801@redhat.com> (raw)
In-Reply-To: <8734u32co5.fsf@email.froward.int.ebiederm.org>

On 02/08, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@redhat.com> writes:
>
> > Turn kill_pid_info() into kill_pid_info_type(), this allows to pass any
> > pid_type to group_send_sig_info(), despite its name it should work fine
> > even if type = PIDTYPE_PID.
> >
> > Change pidfd_send_signal() to use PIDTYPE_PID or PIDTYPE_TGID depending
> > on PIDFD_THREAD.
> >
> > While at it kill another TODO comment in pidfd_show_fdinfo(). As Christian
> > expains fdinfo reports f_flags, userspace can already detect PIDFD_THREAD.
> >
>
> I have a question here.
>
> Why is this based on group_send_sig_info instead of send_sig_info?

Well. send_sig_info() accepts "struct task_struct *", not "struct pid *",
it doesn't do check_kill_permission(), and it doesn't handle the possible
race with mt-exec.

> In particular I am asking are the intended semantics that the signal is
> sent to a single thread in a thread group and placed in the per thread
> queue, or is the signal sent to the entire thread group and placed
> in the thread group signal queue?

This depends on PIDFD_THREAD. If it is set then the signal goes to
the per thread queue.

> Because honestly right now using group_send_sig_info when
> the intended target of the signal is not the entire thread
> group is very confusing when reading your change.

Agreed, so perhaps it makes sense to rename it later. See

	despite its name it should work fine even if type = PIDTYPE_PID.

in the changelog above.

Oleg.


  reply	other threads:[~2024-02-08 15:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 11:45 [PATCH] pidfd: change pidfd_send_signal() to respect PIDFD_THREAD Oleg Nesterov
2024-02-08 13:15 ` Christian Brauner
2024-02-08 13:53   ` Oleg Nesterov
2024-02-08 14:31     ` Christian Brauner
2024-02-08 14:34     ` Oleg Nesterov
2024-02-08 15:33       ` Christian Brauner
2024-02-08 16:11         ` Oleg Nesterov
2024-02-09 10:28       ` Oleg Nesterov
2024-02-09 11:29         ` Christian Brauner
2024-02-08 14:06   ` Oleg Nesterov
2024-02-08 14:33     ` Christian Brauner
2024-02-08 15:33 ` Eric W. Biederman
2024-02-08 15:57   ` Oleg Nesterov [this message]
2024-02-09  9:26     ` Christian Brauner
2024-02-09 10:53       ` 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=20240208155731.GH19801@redhat.com \
    --to=oleg@redhat.com \
    --cc=brauner@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=tycho@tycho.pizza \
    /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;
as well as URLs for NNTP newsgroup(s).