From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>,
"Eric W. Biederman" <ebiederm@xmission.com>,
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 15:34:07 +0100 [thread overview]
Message-ID: <20240208143407.GF19801@redhat.com> (raw)
In-Reply-To: <20240208135344.GD19801@redhat.com>
On 02/08, Oleg Nesterov wrote:
>
> On 02/08, Christian Brauner wrote:
> >
> > On Wed, Feb 07, 2024 at 12:45:49PM +0100, Oleg Nesterov wrote:
> > > + type = (f.file->f_flags & PIDFD_THREAD) ? PIDTYPE_PID : PIDTYPE_TGID;
> > > + ret = kill_pid_info_type(sig, &kinfo, pid, type);
> >
> > If the user doesn't provide siginfo then the kernel fills in the info in
> > prepare_kill_siginfo() a few lines above. That sets info->si_code to
> > SI_USER even for the PIDFD_THREAD case. Whenever the info is filled in
> > by the kernel it's not exactly userspace impersonating anything plus we
> > know that what we're sending to is a pidfd by the type of the pidfd. So
> > it feels like we should fill in SI_TKILL here as well?
>
> Hmm. Agreed, will do, thanks.
Cough... lets forget this patch for the moment.
Is prepare_kill_siginfo() correct when we send a signal to the child
pid namespace? si_pid = task_tgid_vnr(current) doesn't look right in
this case but perhaps I am totally confused.
And why do we need it at all? Can't sys_kill() and pidfd_send_signal()
just use SEND_SIG_NOINFO?
OK, I am sure I missed something. Will read this code tomorrow.
Oleg.
next prev parent reply other threads:[~2024-02-08 14:35 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 [this message]
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
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=20240208143407.GF19801@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).