From: Tycho Andersen <tycho.andersen-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
To: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>,
Will Drewry <wad-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Roland McGrath <roland-/Z5OmTQCD9xF6kxbq+BtvQ@public.gmane.org>,
Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
"Serge E. Hallyn"
<serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2] seccomp: add ptrace options for suspend/resume
Date: Fri, 5 Jun 2015 15:26:56 -0600 [thread overview]
Message-ID: <20150605212656.GH31599@hopstrocity> (raw)
In-Reply-To: <20150605211650.GA25718-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Fri, Jun 05, 2015 at 11:16:50PM +0200, Oleg Nesterov wrote:
> Hi Tycho,
>
> On 06/04, Tycho Andersen wrote:
> >
> > On Thu, Jun 04, 2015 at 08:31:49PM +0200, Oleg Nesterov wrote:
> > > Also. Suppose that the tracer sets SUSPEND_SECCOMP and then drops
> > > CAP_SYS_ADMIN. After that it can't set or clear other ptrace options.
> >
> > Is this a case we're concerned about? I think this should be ok (i.e.
> > "don't do that" :).
>
> Sure, I won't insist. Just this looks a bit confusing. I mean, if you
> read this code it is not clear why may_suspend_seccomp() is called even
> if the tracer changes other bits, and "data & PTRACE_O_SUSPEND" is true
> only because the tracer does _not_ change this option.
>
> IOW, imo the code will just look better if may_suspend_seccomp() is
> called only when PTRACE_O_SUSPEND is set. But this is minor, feel free
> to ignore.
Oh, I understand now. I think this is fixed in v3 that I just sent,
but may go away in any case if we remove the checks...
> > > > +#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?
Doh, just sent v3. If you guys are convinced too, then I can send v4
with these checks removed.
Tycho
WARNING: multiple messages have this Message-ID (diff)
From: Tycho Andersen <tycho.andersen@canonical.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
Kees Cook <keescook@chromium.org>,
Andy Lutomirski <luto@amacapital.net>,
Will Drewry <wad@chromium.org>,
Roland McGrath <roland@hack.frob.com>,
Pavel Emelyanov <xemul@parallels.com>,
"Serge E. Hallyn" <serge.hallyn@ubuntu.com>
Subject: Re: [PATCH v2] seccomp: add ptrace options for suspend/resume
Date: Fri, 5 Jun 2015 15:26:56 -0600 [thread overview]
Message-ID: <20150605212656.GH31599@hopstrocity> (raw)
In-Reply-To: <20150605211650.GA25718@redhat.com>
On Fri, Jun 05, 2015 at 11:16:50PM +0200, Oleg Nesterov wrote:
> Hi Tycho,
>
> On 06/04, Tycho Andersen wrote:
> >
> > On Thu, Jun 04, 2015 at 08:31:49PM +0200, Oleg Nesterov wrote:
> > > Also. Suppose that the tracer sets SUSPEND_SECCOMP and then drops
> > > CAP_SYS_ADMIN. After that it can't set or clear other ptrace options.
> >
> > Is this a case we're concerned about? I think this should be ok (i.e.
> > "don't do that" :).
>
> Sure, I won't insist. Just this looks a bit confusing. I mean, if you
> read this code it is not clear why may_suspend_seccomp() is called even
> if the tracer changes other bits, and "data & PTRACE_O_SUSPEND" is true
> only because the tracer does _not_ change this option.
>
> IOW, imo the code will just look better if may_suspend_seccomp() is
> called only when PTRACE_O_SUSPEND is set. But this is minor, feel free
> to ignore.
Oh, I understand now. I think this is fixed in v3 that I just sent,
but may go away in any case if we remove the checks...
> > > > +#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?
Doh, just sent v3. If you guys are convinced too, then I can send v4
with these checks removed.
Tycho
next prev parent reply other threads:[~2015-06-05 21:26 UTC|newest]
Thread overview: 26+ 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-03 22:09 ` 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:12 ` Kees Cook
[not found] ` <CAGXu5jLBm6ZBptsDTrNV6OrFSwoZ__k3867-Ji+6oYuTQ8ncWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-04 18:03 ` Oleg Nesterov
2015-06-04 18:03 ` Oleg Nesterov
[not found] ` <20150604180303.GA32421-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-04 18:10 ` Kees Cook
2015-06-04 18:10 ` Kees Cook
[not found] ` <1433369396-13360-1-git-send-email-tycho.andersen-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2015-06-04 18:31 ` Oleg Nesterov
2015-06-04 18:31 ` Oleg Nesterov
2015-06-04 21:05 ` Tycho Andersen
2015-06-05 21:16 ` Oleg Nesterov
[not found] ` <20150605211650.GA25718-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-05 21:26 ` Tycho Andersen [this message]
2015-06-05 21:26 ` Tycho Andersen
2015-06-09 21:22 ` Tycho Andersen
2015-06-09 21:22 ` Tycho Andersen
2015-06-09 21:45 ` Kees Cook
2015-06-09 21:45 ` Kees Cook
[not found] ` <CAGXu5jLC-DcS-Mg5OTM-LEkuOKMMGrV2tq+Lky1Mxh_rDLa4Bg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-09 21:52 ` Tycho Andersen
2015-06-09 21:52 ` Tycho Andersen
2015-06-09 22:06 ` Kees Cook
2015-06-09 22:06 ` Kees Cook
[not found] ` <CAGXu5jKB1TZF7KpqpeRVaPZ4P4Zy+Y=WhMqDdrH0GJfs1bAfzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-09 22:13 ` Tycho Andersen
2015-06-09 22:13 ` Tycho Andersen
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=20150605212656.GH31599@hopstrocity \
--to=tycho.andersen-z7wlfzj8ewms+fvcfc7uqw@public.gmane.org \
--cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
--cc=oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=roland-/Z5OmTQCD9xF6kxbq+BtvQ@public.gmane.org \
--cc=serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org \
--cc=wad-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.