Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757766AbbFCQ6N (ORCPT ); Wed, 3 Jun 2015 12:58:13 -0400 Received: from mail-ig0-f177.google.com ([209.85.213.177]:34104 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755330AbbFCQ6D (ORCPT ); Wed, 3 Jun 2015 12:58:03 -0400 Date: Wed, 3 Jun 2015 10:58:00 -0600 From: Tycho Andersen To: Oleg Nesterov Cc: Andrey Wagin , LKML , linux-api@vger.kernel.org, Kees Cook , Andy Lutomirski , Will Drewry , Roland McGrath , Pavel Emelyanov , "Serge E. Hallyn" Subject: Re: [PATCH] seccomp: add ptrace commands for suspend/resume Message-ID: <20150603165800.GF3337@hopstrocity> References: <1433186918-9626-1-git-send-email-tycho.andersen@canonical.com> <20150602130506.GA1823@hopstrocity> <20150602184848.GA24907@redhat.com> <20150603161321.GD3337@hopstrocity> <20150603165451.GA20911@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150603165451.GA20911@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1420 Lines: 43 On Wed, Jun 03, 2015 at 06:54:51PM +0200, Oleg Nesterov wrote: > On 06/03, Tycho Andersen wrote: > > > > On Tue, Jun 02, 2015 at 08:48:48PM +0200, Oleg Nesterov wrote: > > > > > Otherwise, if we use PTRACE_O_ instead, it goes away automatically if > > > the tracer dies or does PTRACE_DETACH. > > > > IIRC the flag goes away, but we still have to do something in > > __ptrace_unlink to clear the seccomp suspended, so I'm not sure if the > > automatic-ness helps us. > > But we do not need seccomp->suspended at all? > > Unless I missed something PTRACE_O_ needs a one-liner patch (ignoring > the defines in include files), > > --- x/kernel/seccomp.c > +++ x/kernel/seccomp.c > @@ -692,6 +692,9 @@ u32 seccomp_phase1(struct seccomp_data * > int this_syscall = sd ? sd->nr : > syscall_get_nr(current, task_pt_regs(current)); > > + if (unlikely(current->ptrace & PT_NAME_OF_THIS_OPTION)) > + return OK; > + > switch (mode) { > case SECCOMP_MODE_STRICT: > __secure_computing_strict(this_syscall); /* may call do_exit */ > > > OK, and the same check in secure_computing_strict(). > > No? I see, I misunderstood. Yes, this is a lot nicer, thank you. Tycho -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/