[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150602192450.GA14907@pc.thejh.net>
Date: Tue, 2 Jun 2015 21:24:50 +0200
From: Jann Horn <jann@...jh.net>
To: Pavel Emelyanov <xemul@...allels.com>
Cc: Oleg Nesterov <oleg@...hat.com>,
Tycho Andersen <tycho.andersen@...onical.com>,
linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
Kees Cook <keescook@...omium.org>,
Andy Lutomirski <luto@...capital.net>,
Will Drewry <wad@...omium.org>,
Roland McGrath <roland@...k.frob.com>,
"Serge E. Hallyn" <serge.hallyn@...ntu.com>
Subject: Re: [PATCH] seccomp: add ptrace commands for suspend/resume
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?)
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists