public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Roland McGrath <roland@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Chris Evans <scarybeasts@gmail.com>,
	David Howells <dhowells@redhat.com>,
	Don Howard <dhoward@redhat.com>, Eugene Teo <eugene@redhat.com>,
	Michael Kerrisk <mtk.manpages@googlemail.com>,
	Tavis Ormandy <taviso@sdf.lonestar.org>,
	Vitaly Mayatskikh <vmayatsk@redhat.com>,
	stable@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] exit_notify: kill the wrong capable(CAP_KILL) check
Date: Wed, 25 Feb 2009 23:32:34 +0100	[thread overview]
Message-ID: <20090225223234.GA16156@redhat.com> (raw)
In-Reply-To: <20090225221415.GA1751@hallyn.com>

On 02/25, Serge E. Hallyn wrote:
>
> Quoting Oleg Nesterov (oleg@redhat.com):
> > On 02/25, Serge E. Hallyn wrote:
> > >
> > > Quoting Roland McGrath (roland@redhat.com):
> > > > > I can't understand why exit_notify() checks capable(CAP_KILL), but this
> > > > > looks just wrong.
> > > >
> > > > I don't know either why it's there.  My guess is that it was not actually
> > > > thought out specifically, just a "unless capable" exception added when the
> > > > security-motivated exclusions (exec_id stuff) were added.
> > > >
> > > > I can't think of any reason not to drop this check.
> > >
> > > Because of the following test?
> > >
> > > #include <stdio.h>
> > > #include <sched.h>
> > > #include <signal.h>
> > > #include <stdlib.h>
> > >
> > > int childfn(void *data)
> > > {
> > > 	printf("hi there, i'm the child\n");
> > > 	sleep(10);
> > > 	exit(0);
> > > }
> > >
> > > int main()
> > > {
> > > 	int stacksize = 4*getpagesize();
> > > 	void *stack, *stacktop;
> > >
> > > 	stack = malloc(stacksize);
> > > 	stacktop = stack + stacksize;
> > >
> > > 	int p = clone(childfn, stacktop, CLONE_PARENT|SIGSTOP, NULL);
> > > 	exit(0);
> > > }
> >
> > Can't understand... Why do you think CAP_KILL makes things better?
> >
> > Actually, how can it make any difference in this case?
>
> Well the check by itself isn't quite right - it seems to me it
> should also check whether tsk->euid == parent->uid.  But letting
> an unprivileged task send SIGSTOP to a privileged one bc of
> some fluke in the task hierarchy doesn't seem right.

I think you misread this CAP_KILL check.

It does not restrict the unprivileged task to send the signal. Instead,
if the exiting task has CAP_KILL, we bypass other security checks.

Oleg.


  reply	other threads:[~2009-02-25 22:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-25 19:02 [PATCH 2/2] exit_notify: kill the wrong capable(CAP_KILL) check Oleg Nesterov
2009-02-25 19:41 ` Roland McGrath
2009-02-25 21:53   ` Serge E. Hallyn
2009-02-25 22:03     ` Oleg Nesterov
2009-02-25 22:14       ` Serge E. Hallyn
2009-02-25 22:32         ` Oleg Nesterov [this message]
2009-02-25 22:47           ` Serge E. Hallyn
2009-02-25 23:16             ` Oleg Nesterov
2009-02-25 23:54               ` Serge E. Hallyn
2009-04-06 14:16 ` [PATCH, RESEND] " Oleg Nesterov
2009-04-06 19:36   ` Roland McGrath

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=20090225223234.GA16156@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dhoward@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=eugene@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@googlemail.com \
    --cc=roland@redhat.com \
    --cc=scarybeasts@gmail.com \
    --cc=serge@hallyn.com \
    --cc=stable@kernel.org \
    --cc=taviso@sdf.lonestar.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vmayatsk@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