Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5000196imd; Tue, 30 Oct 2018 10:25:29 -0700 (PDT) X-Google-Smtp-Source: AJdET5c3rNPcM1JfA1kyg6X66aFjDRO1IN0i5oM9kvTAI5FN9sV95hFeH376MWqFizs8VSb1NZ8O X-Received: by 2002:a63:7d05:: with SMTP id y5-v6mr18765297pgc.171.1540920329765; Tue, 30 Oct 2018 10:25:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540920329; cv=none; d=google.com; s=arc-20160816; b=Nu8feThXj3XdhqqIdgFwCKt913A/SvjDp7iUEIK6q27dc8ypJD8nOhOTVEgHu2qfuY 2i1aTxnMYkN3TZrU25Uyg/X6SBImbDqVhugSt5oQtu5pNa6ikXgIjpricHpYNbOTpCf7 1EeHr/2Hv+YkVV7C9kzTeNIbEMCCXf9RbPjeEE93Cabh0x/3auD5wJMtQsApSZIaTdze xHzZW2WHq/+fjn5vxxGF0FqNt7uaI3mJ7Rk3idMt/soygxQqgWeEaTwcEv+GuD8RYOxz OISiAZUZeqf+pI54HgjLscMvcMsG6n5uOdbICVFxwC7E+I29zQPRgqrIh2nLMgbJ/95C uGZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cIPd0EzG2gMU/qDGJDwuN+fIAgsmdZiWLpuxUpyLet4=; b=K1BMwHmcBgpaKMpuJU4WJy2hInCtHLqNIn9s6NOwVRl48fR6GFiQVvj+Cr2N3kdnIN thd5JDAhS2P9DWImwDf5T1+vxxAOfZhyDkvolLbOAnXANijcZdll9R3txyP9qL0djrnT fduHatHREWQUEmCQmvtZg1vavd9vmsuVoStTsOA1j8ooFT2sRmYfSu3v1cq9rgpyav6P m0z58H/9wdTYnt7np16eFWQug4bPoZKVOhzMktRMGmFStecq8lDFGyoy46nFaLR0USHn /XRz2svVtsVoQ3pW7rP5TJQW2C+B+a51+pWCDnIgyTQOA1RhOmep/ZCcwnScuiP73iUY ouLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=faQ46i56; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3-v6si14495738pld.186.2018.10.30.10.25.10; Tue, 30 Oct 2018 10:25:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=faQ46i56; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727715AbeJaCQ0 (ORCPT + 99 others); Tue, 30 Oct 2018 22:16:26 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:43062 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726501AbeJaCQ0 (ORCPT ); Tue, 30 Oct 2018 22:16:26 -0400 Received: by mail-ot1-f67.google.com with SMTP id k9so11845322otl.10 for ; Tue, 30 Oct 2018 10:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cIPd0EzG2gMU/qDGJDwuN+fIAgsmdZiWLpuxUpyLet4=; b=faQ46i56CpNV+hvDRXtIoRhOuTUFH+vbtEIZKHnJYZd9P0uf32OdqysFfCRl4PqZ9+ ohFpmrqvsqEoUhrvlhHffcOX9YNglp9oYe6VxbHxTQcLL/y7ErBmwvUz1vB4y+Neu4zv ZhmS6V4Eq+XwmNma3sP/lwPJ6kHWWrq5hsCIVvxztnsa+QNMyYoWFOzzEkoFCDQqrxsC alCPGOeiDSzgJ0Z7hX+nExd94kkxWbVfGN0hwW1OcZg7hXpXzgX/f7cyURcoYDgBLxMG I4FM3PRth51VG6SoI+Svgjblr2qMwc6f9u4HyPEMkT1PoLrXC6VTUnC/yrfOCxrqK5h6 bNmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cIPd0EzG2gMU/qDGJDwuN+fIAgsmdZiWLpuxUpyLet4=; b=XLNYfpd/Ox/ZuXIULh9B+/zYnwL1rWu07LuuwO4Ylhnt/yaXVde2LeqIw2xvwtyzJb RmGBziIB7ydKbM+YCBmYj7lX597nQxsl9M4M2GOO1zNoTuEZhL8A8gZkauyYIZ2F6/BM GzKj0WdwafNOu2E+n0siG3h3cMT3IWJ6heg5QWVzfZwyh6xsfzEN2R9yo0S3teDsmSNO RvqAML2MHDlYpJSfkbon3n4XzOOw0pCKL0Fqe2x3B4Js7RMgWweHaabuzFZnjsXB98As Yj2ZyFn9P6OPxiCoFXDpl+fyeSBqMGCntM7YlUK0GPpMvRp2i5a/ubiuVGLncrdYlFaZ Wlsw== X-Gm-Message-State: AGRZ1gL12rcXAXYIwZygc/61TM6vz3559IUtjhf/SOPOv+0QNrPZhu4O UfhGRtCPIHpVvbxYQ5CsVNpWhg== X-Received: by 2002:a9d:437d:: with SMTP id y58mr5322448oti.287.1540920124529; Tue, 30 Oct 2018 10:22:04 -0700 (PDT) Received: from cisco ([128.107.241.170]) by smtp.gmail.com with ESMTPSA id 30sm8129708otr.52.2018.10.30.10.21.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Oct 2018 10:21:59 -0700 (PDT) Date: Tue, 30 Oct 2018 11:21:43 -0600 From: Tycho Andersen To: Oleg Nesterov Cc: Kees Cook , Andy Lutomirski , "Eric W . Biederman" , "Serge E . Hallyn" , Christian Brauner , Tyler Hicks , Akihiro Suda , Aleksa Sarai , linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org, linux-api@vger.kernel.org Subject: Re: [PATCH v8 1/2] seccomp: add a return code to trap to userspace Message-ID: <20181030172143.GD7343@cisco> References: <20181029224031.29809-1-tycho@tycho.ws> <20181029224031.29809-2-tycho@tycho.ws> <20181030150254.GB3385@redhat.com> <20181030155403.GC7343@cisco> <20181030162752.GB7643@redhat.com> <20181030163926.GC7643@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181030163926.GC7643@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 30, 2018 at 05:39:26PM +0100, Oleg Nesterov wrote: > On 10/30, Oleg Nesterov wrote: > > > > On 10/30, Tycho Andersen wrote: > > > > > > @@ -828,6 +823,11 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd, > > > */ > > > rmb(); > > > > > > + if (!sd) { > > > + populate_seccomp_data(&sd_local); > > > + sd = &sd_local; > > > + } > > > + > > > > To me it would be more clean to remove the "if (!sd)" check, case(SECCOMP_RET_TRACE) > > in __seccomp_filter() can simply do populate_seccomp_data(&sd_local) unconditionally > > and pass &sd_local to __seccomp_filter(). > > Ah, please ignore, emulate_vsyscall() does secure_computing(NULL). > > Btw. why __seccomp_filter() doesn't return a boolean? > > Or at least, why can't case(SECCOMP_RET_TRACE) simply do > > return __seccomp_filter(this_syscall, NULL, true); > > ? Yeah, at least the second one definitely makes sense. I can add that as a patch in the next version of this series unless Kees does it before. Thanks for your help, Oleg! Tycho