Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp449431imm; Thu, 13 Sep 2018 02:27:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYtNkySxIv6TxAU5E6mfp+AEsMT3DaIXySdrSzZKT0Ge/nfCpEN47J87ipf3CWpcZCKlPUM X-Received: by 2002:a17:902:52c:: with SMTP id 41-v6mr6409877plf.201.1536830852635; Thu, 13 Sep 2018 02:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536830852; cv=none; d=google.com; s=arc-20160816; b=iGAxImFw9huCzh/DnG90KdlYPJJHrEnmtfqzWAKJWU2wdr+pBoIrMYheYIW70v95gX MznbJusSWCXRJhyZdKwttlbinjewib8mXa67svHidDwPbnqXQg2vBFv0vc8iJjxWPEhZ Ey+Occ4CG8XIUa0gnhlFqye9dQKjzfHlsflzZvROnOnxrTkSzeGfBM/KL79PDoVCkoMF hpZY+EKglaKllqcoX2x77M7FbPlSo0MzQJomaUc42csnwuW1hVtyXhNNklNV7t/YjZXQ mlCdOnGV3bXAnZ6+wCoxnIUZWO3cFo4HvZOv5rlDokJ0+P6cfagEy3jwmYP5HrhVojnD HpPw== 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=UZQdXaxoRG+0tAk3Cn6xebBBU7hBeb3zc2jsH0lfFQI=; b=DbfNJSKzG6t347EaRBD2/VVjmzeE/xQe4IMIsAcBBSKygWBBR1H/uXoe/29vm+cyem uate2L5T0VubRouYfiJD5RzTVpP6iniQW9xJHaoqfT8db49pLTyjXw06pC++e8S8DlNu Rkfj+b5sRcRYpBzaxyFCTq2R2edHUPBj3JhbG+RpL49im+fhkL9/IOKcGR3ktWHRMISl O0XFW+7H77MHGGeKiAoXqgXElZdSEMHW918KUmYPtYgs8s27vJglDL1wUOLkofG0EZnG czvuyqPp6hHos7uQ0ps8/jJgrKQay/uwuls4sHn63CUFsClnIyvUy663gpydNVU2Scv1 /4/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=zNyghv5V; 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 y8-v6si3008031pll.74.2018.09.13.02.27.16; Thu, 13 Sep 2018 02:27:32 -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=zNyghv5V; 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 S1727764AbeIMOe1 (ORCPT + 99 others); Thu, 13 Sep 2018 10:34:27 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:44006 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726821AbeIMOe0 (ORCPT ); Thu, 13 Sep 2018 10:34:26 -0400 Received: by mail-ed1-f65.google.com with SMTP id z27-v6so4045490edb.10 for ; Thu, 13 Sep 2018 02:25:48 -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=UZQdXaxoRG+0tAk3Cn6xebBBU7hBeb3zc2jsH0lfFQI=; b=zNyghv5VIHbiJ/ZdW8k7H2pWQjjw2FvppXdAmspgcj5uQyugNBQou75HLPZ9vO8YZY yE9i24h8sBqx+cKzWqDDLrqK7WSXpIIg37gy+UN7+VNVV/0IzhU6c/qCtimd6svYBmWL 1BZEqVgjYUXkS1i99x7XGBUx8MCDjiW8HazLV0oAe7puxycYGDCI+HdelUeTgvDVUwrj Kdv2al00FqKy9ayLc/xkCryIqYkwbn49xPtF/Vu1yjNZBiDkrueu3rckLrqOFFvlWacB p7n+ArT+tlT4wF+tr4xxKUZmFKnTTCYI8LSb7zXm29DhRsih4NO98gsvMAVpRZYneFCu pAIg== 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=UZQdXaxoRG+0tAk3Cn6xebBBU7hBeb3zc2jsH0lfFQI=; b=Pw26Jwf364Zvk5+FSkYsF/hD/3g0rVz+k9JXliYOi2eJjDez0YFb+BRfpl6OR7E1Bg zT3qUKlmMRXxoenVcLcoJQmaxByOyp8DmBWEj+k+4YpFC14S9Lwh88DqWqLYxDrN8cK1 KR3WXW+6tAg02QTNAKwlurt7GGRhT2OiLi9LwCfCT12X35kKUgD+9YeXovfYn5fxkBNU O31a6JxW7XAj5gBxs38AbASKh//mbLmrDo46HJr0z6G7aQt2Ah3xXEAjSxOfP0DeHZ2d 8uWxBHNYvpfkcuih2uLTvjnTWkJep52zinWDEeLFFqG13kAwaiWXA/xUIFJB+VxXVo4C 5kRQ== X-Gm-Message-State: APzg51D2kSluW8kSYKKh/NjAu/vGGWFvnC7S6OEPeDnRnnmoutzDppHX pEijOTCJTF53aCoaybeT+2JyHA== X-Received: by 2002:a50:95a8:: with SMTP id w37-v6mr9966939eda.33.1536830747907; Thu, 13 Sep 2018 02:25:47 -0700 (PDT) Received: from cisco (85-220-54-220.dsl.dynamic.simnet.is. [85.220.54.220]) by smtp.gmail.com with ESMTPSA id p28-v6sm4848165eda.85.2018.09.13.02.25.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Sep 2018 02:25:46 -0700 (PDT) Date: Thu, 13 Sep 2018 03:25:44 -0600 From: Tycho Andersen To: Andy Lutomirski Cc: Kees Cook , LKML , Linux Containers , Linux API , Oleg Nesterov , "Eric W . Biederman" , "Serge E . Hallyn" , Christian Brauner , Tyler Hicks , Akihiro Suda , Jann Horn Subject: Re: [PATCH v6 4/5] seccomp: add support for passing fds via USER_NOTIF Message-ID: <20180913092544.GC4672@cisco> References: <20180906152859.7810-1-tycho@tycho.ws> <20180906152859.7810-5-tycho@tycho.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, Sep 12, 2018 at 04:52:38PM -0700, Andy Lutomirski wrote: > On Thu, Sep 6, 2018 at 8:28 AM, Tycho Andersen wrote: > > The idea here is that the userspace handler should be able to pass an fd > > back to the trapped task, for example so it can be returned from socket(). > > > > I've proposed one API here, but I'm open to other options. In particular, > > this only lets you return an fd from a syscall, which may not be enough in > > all cases. For example, if an fd is written to an output parameter instead > > of returned, the current API can't handle this. Another case is that > > netlink takes as input fds sometimes (IFLA_NET_NS_FD, e.g.). If netlink > > ever decides to install an fd and output it, we wouldn't be able to handle > > this either. > > An alternative could be to have an API (an ioctl on the listener, > perhaps) that just copies an fd into the tracee. There would be the > obvious set of options: do we replace an existing fd or allocate a new > one, and is it CLOEXEC. Then the tracer could add an fd and then > return it just like it's a regular number. > > I feel like this would be more flexible and conceptually simpler, but > maybe a little slower for the common cases. What do you think? Yes, I like this. It also future (or current-) proofs the API against instances where we return an FD in a structure and not via the return code of the syscall. Tycho