From: Jann Horn <jann@thejh.net>
To: Pavel Emelyanov <xemul@parallels.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
Tycho Andersen <tycho.andersen@canonical.com>,
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>,
"Serge E. Hallyn" <serge.hallyn@ubuntu.com>
Subject: Re: [PATCH] seccomp: add ptrace commands for suspend/resume
Date: Tue, 2 Jun 2015 21:24:50 +0200 [thread overview]
Message-ID: <20150602192450.GA14907@pc.thejh.net> (raw)
In-Reply-To: <556DFDB2.3050205@parallels.com>
[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]
On Tue, Jun 02, 2015 at 10:02:10PM +0300, Pavel Emelyanov wrote:
>
> >> +int suspend_seccomp(struct task_struct *task)
> >> +{
> >> + int ret = -EACCES;
> >> +
> >> + spin_lock_irq(&task->sighand->siglock);
> >> +
> >> + if (!capable(CAP_SYS_ADMIN))
> >> + goto out;
> >
> > I am puzzled ;) Why do we need ->siglock? And even if we need it, why
> > we can't check CAP_SYS_ADMIN lockless?
> >
> > And I am not sure I understand why do we need the additional security
> > check, but I leave this to you and Andy.
> >
> > If you have the rights to trace this task, then you can do anything
> > the tracee could do without the filtering.
>
> I think _this_ check is required, otherwise the seccomp-ed task (in
> filtered mode) fork-s a child, then this child ptrace-attach to parent
> (allowed) then suspend its seccomd. And -- we have unpriviledged process
> de-seccomped.
If you can ptrace(), you can already escape from seccomp. See this
section in man 2 seccomp, in the SECCOMP_RET_TRACE section:
The seccomp check will not be run again after the tracer is
notified. (This means that seccomp-based sandboxes must not
allow use of ptrace(2)—even of other sandboxed processes—
without extreme care; ptracers can use this mechanism to
escape from the seccomp sandbox.)
(But I think there have been discussions about changing that behavior in
the future?)
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-06-02 19:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 19:28 [PATCH] seccomp: add ptrace commands for suspend/resume Tycho Andersen
2015-06-01 19:38 ` Andy Lutomirski
2015-06-01 19:47 ` Tycho Andersen
2015-06-01 19:51 ` Andy Lutomirski
2015-06-01 20:12 ` Tycho Andersen
2015-06-02 15:46 ` Tycho Andersen
2015-06-01 20:00 ` Tycho Andersen
2015-06-02 9:36 ` Andrey Wagin
2015-06-02 13:05 ` Tycho Andersen
2015-06-02 18:48 ` Oleg Nesterov
2015-06-03 16:13 ` Tycho Andersen
2015-06-03 16:54 ` Oleg Nesterov
2015-06-03 16:58 ` Tycho Andersen
2015-06-03 18:36 ` Tycho Andersen
2015-06-02 18:28 ` Oleg Nesterov
2015-06-02 19:02 ` Pavel Emelyanov
2015-06-02 19:24 ` Jann Horn [this message]
2015-06-02 19:27 ` Andy Lutomirski
2015-06-03 14:45 ` Tycho Andersen
2015-06-02 21:27 ` Oleg Nesterov
2015-06-03 14:43 ` Tycho Andersen
2015-06-03 16:41 ` Oleg Nesterov
2015-06-03 17:10 ` Tycho Andersen
2015-06-03 17:11 ` Andy Lutomirski
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=20150602192450.GA14907@pc.thejh.net \
--to=jann@thejh.net \
--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=tycho.andersen@canonical.com \
--cc=wad@chromium.org \
--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