Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp742458imm; Thu, 6 Sep 2018 09:24:35 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda/u7zwreefYyD5OiLsp436KNnW4iOi/5FlYCawL+FNCkRCFvMhHp77DvoyOjKrw3jRFBB7 X-Received: by 2002:a62:6104:: with SMTP id v4-v6mr3782655pfb.122.1536251074942; Thu, 06 Sep 2018 09:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536251074; cv=none; d=google.com; s=arc-20160816; b=xdNdaZN3hgapb0zaduS0vTyi+Y7z7bJuC2XbKnTrdK9TI3M/69FVJp91/eyYMrWKEZ 9ifsr6D7W4DbxzrSCEoRDFQqc4VHhwQFqM+KusUoW4azLmcWm5K28gLbxk5a39KkF5VK /gR7gE448lkNa9m/d/EanQTrGbpbuuddNgiMKjb2fC5HsNbELStGUWh1/16xxfOjRPuO OHA7gBHy1MEapWCoQLDT5eQTN3ZqQ8nB2F7CB4GxuoTpxcvwQf7n/YOXXDDgeIFAzJXI pbAc+ujBuYtQ8otgQKpPr7lwfqNxpb8j1Ne7QfyvpZHRcehwHO7Jsl4V9L8lw8ojTn0/ X4qQ== 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=w29DW2Vfqsb64YF/CFDEkfLEzFBB5iLBf9jAomVruYQ=; b=zwmpWEHf5zdqXu+4W28ilqT2zuIFFfzqqDGG82DyO8pzLHrQLfiOdQlKEHZwG/rX6Q nKjvp0uqHx25A2GKwZQPCVE7V5sGycFlPDgqhlQX6h2Y7SmjE6XSrbyByyTpYMz9Ddkj /rXy6JBMwaslea4gRL9I4Xw5xjJewkRA0QU89VNCieofhNrw66zEJvCyhBiMcFEY7J6h Pg6rnjB9j+q0rcfjwuNyR5Acd8DUwR7YergrQY25QKhRwu7+SQlaEpd+leG+itFKn0Y+ YjmCoS+whZdHaOYf8263IHknwaQ2EskjKG7Z6p0dhUH5FXauAoAROLpWPTO1X+TQM6c9 3whg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=EhUzZyuB; 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 bj4-v6si5090791plb.119.2018.09.06.09.24.18; Thu, 06 Sep 2018 09:24:34 -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=EhUzZyuB; 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 S1727750AbeIFU7G (ORCPT + 99 others); Thu, 6 Sep 2018 16:59:06 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:43126 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbeIFU7F (ORCPT ); Thu, 6 Sep 2018 16:59:05 -0400 Received: by mail-qt0-f194.google.com with SMTP id g53-v6so12914859qtg.10 for ; Thu, 06 Sep 2018 09:22:50 -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=w29DW2Vfqsb64YF/CFDEkfLEzFBB5iLBf9jAomVruYQ=; b=EhUzZyuBD9KfMw/MW9wcJ3C/5walSCSaycbKfEPDETgwQMPBaBThW5KByCBuJATYps YJeqAL8gLrK7ygH7NxKuP4WzZhcQq7eozHLrkqhO+z+GqwFuwszTwD4T7y2/uftwzwkj xFlHv97/dhfIKlaNOJRXIMoyymVyjl6qtONctU75wqelq9kYCLGDw1KhJZ45WkiLiibI L7+C54v+5dsyvU9MA9ItSnzPq3NOpwqTF+XTG1xbhcJWBdtAalLa0Aq2naSNm+PyG3ol 8QLM8Vi03TW/TzNTHmBc/zneJonwcoula6Wm2J5wUVsDPVSEUy8ddEl6TMZN/ARfWCAq N1bg== 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=w29DW2Vfqsb64YF/CFDEkfLEzFBB5iLBf9jAomVruYQ=; b=KUdnGeME+44t6TwWzq9E6GEq0skiXrtV8j2g9mqqagXcDkvoSGfXJy5vDmp28+T/l8 4ievJHeDUBCpRmRRo9Qy4Y6EPa9tqma/7n65Hl0PYI49UITHGBqrfESJ16JaOj3na1Iw 47wLRyIfKKKKlOzPmyVkQErGsqQxYZpYJkaxY4P54yaGka68HqTUsooOZFHRdXasfsNa fx3xdoM52+AEG+nltvEI7X0btQ7IsLqQ9XVd2WUE818kldD2kpJOcs5UBgQlajQcnafg werKLx1SpmvTNM127CxwR+1QK24LoSyGisRQWIG7fB+jpfmD4q28urMXVUV/QwQyGRIQ uizA== X-Gm-Message-State: APzg51A7OyPWrOCAyIpot3Qbz5Ucdko5KUTtrNEG8s7kKHBdMp3L4hEH 6CsPRZUw0uqRlzQMmpUq6b6Kew== X-Received: by 2002:aed:3e17:: with SMTP id l23-v6mr2901430qtf.52.1536250970109; Thu, 06 Sep 2018 09:22:50 -0700 (PDT) Received: from cisco.cisco.com ([173.38.117.76]) by smtp.gmail.com with ESMTPSA id n189-v6sm3277415qkn.2.2018.09.06.09.22.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Sep 2018 09:22:49 -0700 (PDT) Date: Thu, 6 Sep 2018 10:22:46 -0600 From: Tycho Andersen To: Jann Horn Cc: Kees Cook , kernel list , containers@lists.linux-foundation.org, Linux API , Andy Lutomirski , Oleg Nesterov , "Eric W. Biederman" , "Serge E. Hallyn" , Christian Brauner , Tyler Hicks , suda.akihiro@lab.ntt.co.jp Subject: Re: [PATCH v6 4/5] seccomp: add support for passing fds via USER_NOTIF Message-ID: <20180906162246.GB3326@cisco.cisco.com> 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 Thu, Sep 06, 2018 at 06:15:18PM +0200, Jann Horn wrote: > On Thu, Sep 6, 2018 at 5:29 PM 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(). > [...] > > diff --git a/Documentation/userspace-api/seccomp_filter.rst b/Documentation/userspace-api/seccomp_filter.rst > > index d1498885c1c7..1c0aab306426 100644 > > --- a/Documentation/userspace-api/seccomp_filter.rst > > +++ b/Documentation/userspace-api/seccomp_filter.rst > > @@ -235,6 +235,9 @@ The interface for a seccomp notification fd consists of two structures: > > __u64 id; > > __s32 error; > > __s64 val; > > + __u8 return_fd; > > + __u32 fd; > > + __u32 fd_flags; > > Normally, syscalls that take an optional file descriptor accept a > signed 32-bit number, with -1 standing for "no file descriptor". Is > there a reason why this uses a separate variable to signal whether an > fd was provided? No real reason other than I looked at the bpf code and they were using __u32 for bpf (but I think in their case the fd args are not optional). I'll switch it to __s32/-1 for the next version. > Apart from that, this patch looks good to me. Thanks, Tycho