Received: by 10.223.185.116 with SMTP id b49csp1135897wrg; Wed, 14 Feb 2018 12:10:25 -0800 (PST) X-Google-Smtp-Source: AH8x225CeQfk235yUZcLTkAuimVOpI0RyyNT3PAgsUMsLRjuIpX8lSBqPrV5v56ExRxKQL+8hAPW X-Received: by 2002:a17:902:6d01:: with SMTP id s1-v6mr204630plk.176.1518639025445; Wed, 14 Feb 2018 12:10:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518639025; cv=none; d=google.com; s=arc-20160816; b=kVZ0RgjWev1kequqJBP6kHjeS+5dK1APetPk+MVeKpGGhOdJ+RylFgXSZH38meYAjW av7YFyoGCXBOrg+6yqkSLj7hE+AvUJXFs5M+l5kfBWiCBpv2zpYSUEKMW1m8+i1zexaN FxRUlAoFmvgQNnzfwlWlLl7pEQyO1CBPdOlWKRNPlSfsqlNX+rj+ei/Nx0/d0ofO6+bt pdpf3AqZ281ESYViEB4lVJdd8Ev+iAJEmNfT3E+9bQsY+bgpPLUoVFYUsyGttDA4sKYi PMW8VW7yXI7Tv4WKtCnr6NXUsYx03vTVEuyOggJKNVWTsHYDB7nz+qesPzWdFw5Y39a2 fNWg== 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:arc-authentication-results; bh=NNkfOR9rvrgF6tIDVj8KCDxsNAm07o3VRSvGOjacAdA=; b=OLSMwNo9nlFvxvDdhXaZueCLz0BZKhbKWemBCobuIOggZDLBHUCnPayG6rxxzqdYEL yUL9u3KdDupAKeSZ6mPRQgEArH6DdMSeMv3tXP3YP0IgY0J9D+3cHh7eflBrsXg+ZN6I REfJobvHuMCbWvt8OL21DLOkQuh5usCvX2/VIpNooJoq5jjHJXT55STIGtLaq8SJvVJc hBzwpmC9DNUu8NwMb/IRtiwY0t6qgke/QCVkx6NyvIYGLrLUBJthz8jKqud9MDw0Qn/M lbsk5J8FMW7rKTdWJiisv7BIaoBQDglJpgTPnoahFtWIGxyIHJVIyoikTUz1PxHT9xTk AhvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=wtGORCW9; 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 b31-v6si9408150plb.24.2018.02.14.12.10.10; Wed, 14 Feb 2018 12:10:25 -0800 (PST) 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=wtGORCW9; 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 S1161162AbeBNRXH (ORCPT + 99 others); Wed, 14 Feb 2018 12:23:07 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:45556 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033384AbeBNRXF (ORCPT ); Wed, 14 Feb 2018 12:23:05 -0500 Received: by mail-pl0-f66.google.com with SMTP id p5so8880314plo.12 for ; Wed, 14 Feb 2018 09:23:04 -0800 (PST) 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=NNkfOR9rvrgF6tIDVj8KCDxsNAm07o3VRSvGOjacAdA=; b=wtGORCW97IIRA8OF5WrOOIsAtcjIkD72blv0Ifh4cNp8rdHmS89ddIopyfekQOl5OG HIuDHMctI6UVQpQY9EuEhQkE4gv6ceW9Z3Jx/OGCiZKLr4n7nwTOCfPu5Wxldsc2Ccqq kxzkY4X4P/TAErx+/+mtLipnzZKo6+BsKJjCiuPexDMGo647Ze5udf9/0ub+qet+Ngf1 eUfvajOVKzxvnIK+VIEIWM6ZXnGm58diZopArwhcbHB17xxYP2NAOHmaSdyUDEklZ9Vs HqmijdNy3VBIiLVynANRDXqSNGqkP2tBRPhF16KHus9FKuiRTuuSEBX9VHvoDWiWIdkq cqTg== 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=NNkfOR9rvrgF6tIDVj8KCDxsNAm07o3VRSvGOjacAdA=; b=qGi83xvev8MQH9Kx+FgPZRPVMnaDaCN9mSUvPLOXnsIrNHEGHC94xbGS1OaGCh4v5x FXdsIt6ey7E2upG7eHPsAbD6Jh2khzT0teyPoqjAQw071ogTBwapVJ7II59e2hIiMUeK Z6hfq+daA5u3ncnC6KHmXG9DjQiMiqUoVo15MAl9gf6eJ9f8typx6mTHu/Qg3YImRkft JB+0AfMOCqpYtE9VXHi4OPCNUU9ZbX939kefBwslp/dFE7hLZYuaIDs7s6C8akQEIQeW gl2tvmpT0X6yUb+Nx1jXts+c+26AbvaKoSR6GvWjcpwhB8Dq1UNRtfedHkf0c8mBg4J+ 6Wcg== X-Gm-Message-State: APf1xPC3bgmevVF0LpInH8EJbiaQQPfDYGVYIsWaUGGu0Qt65coY97bK gPZTRJMG8VJbh+j4soqqNa5Sgw== X-Received: by 2002:a17:902:9893:: with SMTP id s19-v6mr5067523plp.101.1518628984011; Wed, 14 Feb 2018 09:23:04 -0800 (PST) Received: from cisco ([128.107.241.167]) by smtp.gmail.com with ESMTPSA id h2sm28736367pgp.65.2018.02.14.09.23.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Feb 2018 09:23:02 -0800 (PST) Date: Wed, 14 Feb 2018 10:23:00 -0700 From: Tycho Andersen To: Andy Lutomirski Cc: Kees Cook , LKML , Linux Containers , Oleg Nesterov , "Eric W . Biederman" , "Serge E . Hallyn" , Christian Brauner , Tyler Hicks , Akihiro Suda , Tom Hromatka , Sargun Dhillon , Paul Moore Subject: Re: [RFC 1/3] seccomp: add a return code to trap to userspace Message-ID: <20180214172300.7v2pre4rv4zzrj3s@cisco> References: <20180204104946.25559-1-tycho@tycho.ws> <20180204104946.25559-2-tycho@tycho.ws> <20180214152958.cjgwh2k52zji2jxk@cisco> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 14, 2018 at 05:19:52PM +0000, Andy Lutomirski wrote: > On Wed, Feb 14, 2018 at 3:29 PM, Tycho Andersen wrote: > > Hey Kees, > > > > Thanks for taking a look! > > > > On Tue, Feb 13, 2018 at 01:09:20PM -0800, Kees Cook wrote: > >> On Sun, Feb 4, 2018 at 2:49 AM, Tycho Andersen wrote: > >> > This patch introduces a means for syscalls matched in seccomp to notify > >> > some other task that a particular filter has been triggered. > >> > > >> > The motivation for this is primarily for use with containers. For example, > >> > if a container does an init_module(), we obviously don't want to load this > >> > untrusted code, which may be compiled for the wrong version of the kernel > >> > anyway. Instead, we could parse the module image, figure out which module > >> > the container is trying to load and load it on the host. > >> > > >> > As another example, containers cannot mknod(), since this checks > >> > capable(CAP_SYS_ADMIN). However, harmless devices like /dev/null or > >> > /dev/zero should be ok for containers to mknod, but we'd like to avoid hard > >> > coding some whitelist in the kernel. Another example is mount(), which has > >> > many security restrictions for good reason, but configuration or runtime > >> > knowledge could potentially be used to relax these restrictions. > >> > >> Related to the eBPF seccomp thread, can the logic for these things be > >> handled entirely by eBPF? My assumption is that you still need to stop > >> the process to do something (i.e. do a mknod, or a mount) before > >> letting it continue. Is there some "wait for notification" system in > >> eBPF? > > > > I replied in the other thread > > (https://patchwork.ozlabs.org/cover/872938/#1856642 for those > > following along at home), but no, at least not that I know of. > > eBPF can call functions. One of those functions could put the caller > to sleep. In fact, I think I once proposed doing this for the seccomp > logging action as well. Yes, true. We could always add a bpf_func_map_lookup_wait or something. I can look into that if it's preferable.