From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: [PATCH v4] seccomp: add ptrace options for suspend/resume Date: Wed, 10 Jun 2015 10:42:01 -0700 Message-ID: References: <1433897388-9567-1-git-send-email-tycho.andersen@canonical.com> <20150610163149.GA5092@redhat.com> <20150610172931.GD4069@ubuntumail> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <20150610172931.GD4069@ubuntumail> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Serge Hallyn Cc: Oleg Nesterov , Tycho Andersen , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Linux API , Kees Cook , Will Drewry , Roland McGrath , Pavel Emelyanov List-Id: linux-api@vger.kernel.org On Wed, Jun 10, 2015 at 10:29 AM, Serge Hallyn wrote: > Quoting Andy Lutomirski (luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org): >> On Wed, Jun 10, 2015 at 9:31 AM, Oleg Nesterov wrote: >> > On 06/09, Andy Lutomirski wrote: >> >> >> >> On Tue, Jun 9, 2015 at 5:49 PM, Tycho Andersen >> >> > >> >> > @@ -556,6 +556,15 @@ static int ptrace_setoptions(struct task_struct *child, unsigned long data) >> >> > if (data & ~(unsigned long)PTRACE_O_MASK) >> >> > return -EINVAL; >> >> > >> >> > + if (unlikely(data & PTRACE_O_SUSPEND_SECCOMP)) { >> > >> > Well, we should do this if >> > >> > (data & O_SUSPEND) && !(flags & O_SUSPEND) >> > >> > or at least if >> > >> > (data ^ flags) & O_SUSPEND >> > >> > >> >> > + if (!config_enabled(CONFIG_CHECKPOINT_RESTORE) || >> >> > + !config_enabled(CONFIG_SECCOMP)) >> >> > + return -EINVAL; >> >> > + >> >> > + if (!capable(CAP_SYS_ADMIN)) >> >> > + return -EPERM; >> >> >> >> I tend to think that we should also require that current not be using >> >> seccomp. Otherwise, in principle, there's a seccomp bypass for >> >> privileged-but-seccomped programs. >> > >> > Andy, I simply can't understand why do we need any security check at all. >> > >> > OK, yes, in theory we can have a seccomped CAP_SYS_ADMIN process, seccomp >> > doesn't filter ptrace, you hack that process and force it to attach to >> > another CAP_SYS_ADMIN/seccomped process, etc, etc... Looks too paranoid >> > to me. >> >> I've sometimes considered having privileged processes I write fork and >> seccomp their child. Of course, if you're allowing ptrace through >> your seccomp filter, you open a giant can of worms, but I think we >> should take the more paranoid approach to start and relax it later as > > I really do intend to look at your old proposed tree for improving that... > have only done a once-over so far, though. Don't read it yet. It's unnecessarily complicated due to the mess that is x86's entry code, and I want to clean up the entry code first. --Andy