lkml.org 
[lkml]   [2024]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] pidfd: change pidfd_send_signal() to respect PIDFD_THREAD
On 02/16, Christian Brauner wrote:
>
> On Wed, Feb 14, 2024 at 01:36:56PM +0100, Oleg Nesterov wrote:
> >
> > and I am not sure that task_pid(current) == pid should allow
> > the "arbitrary signals" if PIDFD_SIGNAL_PROCESS_GROUP.
> >
> > Perhaps
> >
> > /* Only allow sending arbitrary signals to yourself. */
> > ret = -EPERM;
> > if ((task_pid(current) != pid || type == PIDTYPE_PGID) &&
> > (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL)
> > goto err;
>
> Honestly, we should probably just do:
>
> if (kinfo->si_code != SI_USER)
> goto err

Hmm. This doesn't look right. The purpose of the current check is to
forbid SI_TKILL and si_code >= 0, and SI_USER == 0.

SI_USER means that the target can trust the values of si_pid/si_uid
in siginfo.

> + if (kinfo.si_code != SI_USER)
> goto err;

See above...

Oleg.


\
 
 \ /
  Last update: 2024-05-27 15:06    [W:0.124 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site