public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tycho Andersen <tycho.andersen@canonical.com>
To: Kees Cook <keescook@chromium.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux API <linux-api@vger.kernel.org>,
	Roland McGrath <roland@hack.frob.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	"Serge E. Hallyn" <serge.hallyn@ubuntu.com>,
	Will Drewry <drewry@google.com>
Subject: Re: [PATCH v2] seccomp: add ptrace options for suspend/resume
Date: Tue, 9 Jun 2015 16:13:26 -0600	[thread overview]
Message-ID: <20150609221326.GH2045@hopstrocity> (raw)
In-Reply-To: <CAGXu5jKB1TZF7KpqpeRVaPZ4P4Zy+Y=WhMqDdrH0GJfs1bAfzA@mail.gmail.com>

On Tue, Jun 09, 2015 at 03:06:07PM -0700, Kees Cook wrote:
> On Tue, Jun 9, 2015 at 2:52 PM, Tycho Andersen
> <tycho.andersen@canonical.com> wrote:
> > On Tue, Jun 09, 2015 at 02:45:49PM -0700, Kees Cook wrote:
> >> On Tue, Jun 9, 2015 at 2:22 PM, Tycho Andersen
> >> <tycho.andersen@canonical.com> wrote:
> >> > Hi Kees, Andy,
> >> >
> >> > On Fri, Jun 05, 2015 at 11:16:50PM +0200, Oleg Nesterov wrote:
> >> >> Hi Tycho,
> >> >>
> >> >> On 06/04, Tycho Andersen wrote:
> >> >> > > > +#ifdef CONFIG_CHECKPOINT_RESTORE
> >> >> > > > +bool may_suspend_seccomp(void)
> >> >> > > > +{
> >> >> > > > +       if (!capable(CAP_SYS_ADMIN))
> >> >> > > > +               return false;
> >> >> > > > +
> >> >> > > > +       if (current->seccomp.mode != SECCOMP_MODE_DISABLED)
> >> >> > > > +               return false;
> >> >> > >
> >> >> > > Heh. OK, I won't argue with the new check too ;)
> >> >> >
> >> >> > Actually now that I think about it I agree with you, these checks
> >> >> > don't seem necessary. Even inside a user namespace, if you can ptrace
> >> >> > a process you can make it do whatever you want irrespective of
> >> >> > seccomp, as long as it has the necessary capabilities. Once the
> >> >> > seccomp checks are run after ptrace, they'll be enforced so you
> >> >> > couldn't have it call whatever you want in the first place.
> >> >>
> >> >> Good ;)
> >> >>
> >> >> > Still, perhaps I'm missing something...
> >> >>
> >> >> Kees, Andy?
> >> >
> >> > Any thoughts on removing may_suspend_seccomp() all together?
> >>
> >> As in, just open-code the check? That would be fine by me.
> >
> > Sorry, I meant getting rid of any checks entirely. Using my argument
> > above I've managed to convince myself they don't add any value. You
> > guys know a lot more about this than I do, though.
> 
> Well, as things stand currently, yes, that check would be redundant.
> The fact that ptrace can be used to bypass seccomp is kind of an
> accident, though. The design for ptrace-based seccomp managers was
> that the manager would do the work, rather than rewriting the syscall
> on behalf of the child. I don't think anything actually uses this
> effect. It's something we've wanted to fix, though a clean solution
> isn't obvious. As a result, I'm cautious to add this behavior in such
> a wide open fashion. For now, I'd like to limit the scope of this to
> CAP_SYS_ADMIN.
> 
> I do think dropping the seccomp.mode check is fine -- this would mean
> you could set this flag before the child even added seccomp filters.
> So, instead of the function call, maybe just add the capable() call?

Ok, sounds good; I'll make the change and re-send.

Thanks!

Tycho

      reply	other threads:[~2015-06-09 22:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 22:09 [PATCH v2] seccomp: add ptrace options for suspend/resume Tycho Andersen
2015-06-04 16:44 ` Kees Cook
2015-06-04 17:15   ` Tycho Andersen
2015-06-04 18:12     ` Kees Cook
2015-06-04 18:03   ` Oleg Nesterov
2015-06-04 18:10     ` Kees Cook
2015-06-04 18:31 ` Oleg Nesterov
2015-06-04 21:05   ` Tycho Andersen
2015-06-05 21:16     ` Oleg Nesterov
2015-06-05 21:26       ` Tycho Andersen
2015-06-09 21:22       ` Tycho Andersen
2015-06-09 21:45         ` Kees Cook
2015-06-09 21:52           ` Tycho Andersen
2015-06-09 22:06             ` Kees Cook
2015-06-09 22:13               ` Tycho Andersen [this message]

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=20150609221326.GH2045@hopstrocity \
    --to=tycho.andersen@canonical.com \
    --cc=drewry@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    --cc=roland@hack.frob.com \
    --cc=serge.hallyn@ubuntu.com \
    --cc=xemul@parallels.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