lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 16 Feb 2024 13:28:24 +0100
From: Christian Brauner <brauner@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andy Lutomirski <luto@...capital.net>, 
	"Eric W. Biederman" <ebiederm@...ssion.com>, Tycho Andersen <tycho@...ho.pizza>, linux-api@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] pidfd: change pidfd_send_signal() to respect
 PIDFD_THREAD

On Wed, Feb 14, 2024 at 01:36:56PM +0100, Oleg Nesterov wrote:
> On 02/10, Oleg Nesterov wrote:
> >
> > On 02/10, Christian Brauner wrote:
> > >
> > > +	if (type == PIDFD_SIGNAL_PROCESS_GROUP)
> > > +		ret = kill_pgrp_info(sig, &kinfo, pid);
> >
> > I guess you meant
> >
> > 	if (type == PIDTYPE_PGID)
> >
> > other than that,
> >
> > Reviewed-by: Oleg Nesterov <oleg@...hat.com>
> 
> Yes, but there is another thing I hadn't thought of...
> 
> sys_pidfd_send_signal() does
> 
> 	/* Only allow sending arbitrary signals to yourself. */
> 	ret = -EPERM;
> 	if ((task_pid(current) != pid) &&
> 	    (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL))
> 		goto err;
> 
> 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

and be done with it. If we get regressions reports about this then it's
easy to fix that up. But I find that unlikely. So why not try to get
away with something much simpler. What do you think?

View attachment "0001-signal-disallow-non-SI_USER-signals-in-pidfd_send_si.patch" of type "text/x-diff" (1741 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ