Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp380200ybm; Fri, 29 May 2020 02:27:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8daSv/Q1SnA4Z2R7F/l3ssLQn+veBBLgMBWIahAYIfDRdCYYAIAToWboAwzYI+FaZND58 X-Received: by 2002:aa7:c617:: with SMTP id h23mr7510076edq.305.1590744452595; Fri, 29 May 2020 02:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590744452; cv=none; d=google.com; s=arc-20160816; b=hbVU0S117C0/1VT1rZ+vhO9t7RiZpjvSRFOTWtdwEegcqL3O82y8KL+DXE0Zk5qGfH g0fQEQfIjX3Jkw2y8SJKHQC4YlsF48QTHPh5X5ZVQh3eLEYuCgk7c6VKcoil4R+3TbEs 4WzpSRrLCB2kRf8DrqwchAU4zgrfMF0xqnkbF4YdaxQVLPayBXYyhwTYelWdatiwpOVT ogRQ/VMWKhAmWyyAl3Kf3Owgl6AVemRCFZtkKs2UQqu1595kdJsUidX8brihtqtbchB2 il/0PwI/aPqom9SrcLZ/TCKClRARE/7TxP7LOsfMOKLw8MDLAQ5mcoFbbvMDxcqPPpK2 /Ikw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature; bh=BzM0J67x9nJBmGOHRTCJF7StURA0qrq0ZGgLKSvupb4=; b=tZg/833urz/oaGgmKFnn+cLGjXX2FunBNyKAlBfDqlrR7BdqNVOtrbyQdWGs15cgsk HAyb7mahkskAOXKPblgTN7MfdVJEO2FWM/MmcNuoK+NQFf7d5A1E4LfpTRxtzzmpUBZZ hMZW/OgPcmK5HBzrTfi/0FBosjV8C8pFZAVPES13SP373XHBFSZROn1MHdn8HcjS4uOX U2wu1Ge4P67M2cRgraXtBWHDRyamckcwYTHL3RgTz32U2KRnewsxYSH3ukgr+5lwBBT7 V2fG6Bif98Mb9tCblV1hOeihrlU8Sj14EkdrM3k3x8Tva6aL+6N5M7/qiOyRtjv9al8U JMqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QWaOpvf9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l19si4914624edr.61.2020.05.29.02.27.09; Fri, 29 May 2020 02:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QWaOpvf9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725913AbgE2JYn (ORCPT + 99 others); Fri, 29 May 2020 05:24:43 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:60044 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725306AbgE2JYm (ORCPT ); Fri, 29 May 2020 05:24:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590744281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BzM0J67x9nJBmGOHRTCJF7StURA0qrq0ZGgLKSvupb4=; b=QWaOpvf94DHgxt0fJHkFIcpcJGz7EMuI1X3LHIl8fGF8d6zwtVOiePiPItrSqcPQbN3ZVQ cTUiEYLwB0lBjORoSrR4ZYNusvN+uxQCC+FHBq2jg7n7fwr0iCV7XAInOwq4nCtDm0lZzE a4NsDmnIp56U6UUuhsqqtQjt13dK3x8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-458-5GcvbPxhP66LlxY34JBtFw-1; Fri, 29 May 2020 05:24:37 -0400 X-MC-Unique: 5GcvbPxhP66LlxY34JBtFw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1133107ACF2; Fri, 29 May 2020 09:24:35 +0000 (UTC) Received: from localhost (ovpn-113-216.ams2.redhat.com [10.36.113.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36EAC5C1C3; Fri, 29 May 2020 09:24:34 +0000 (UTC) From: Giuseppe Scrivano To: Sargun Dhillon Cc: keescook@chromium.org, rsesek@google.com, palmer@google.com, jannh@google.com, jeffv@google.com, containers@lists.linux-foundation.org, Kees Cook , linux-kernel@vger.kernel.org, Matt Denton , linux-api@vger.kernel.org, christian.brauner@ubuntu.com Subject: Re: [PATCH v2 2/3] seccomp: Introduce addfd ioctl to seccomp user notifier References: <20200528110858.3265-1-sargun@sargun.me> <20200528110858.3265-3-sargun@sargun.me> Date: Fri, 29 May 2020 11:24:33 +0200 In-Reply-To: <20200528110858.3265-3-sargun@sargun.me> (Sargun Dhillon's message of "Thu, 28 May 2020 04:08:57 -0700") Message-ID: <87wo4vt7ou.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sargun Dhillon writes: > This adds a seccomp notifier ioctl which allows for the listener to "add" > file descriptors to a process which originated a seccomp user > notification. This allows calls like mount, and mknod to be "implemented", > as the return value, and the arguments are data in memory. On the other > hand, calls like connect can be "implemented" using pidfd_getfd. > > Unfortunately, there are calls which return file descriptors, like > open, which are vulnerable to TOC-TOU attacks, and require that the > more privileged supervisor can inspect the argument, and perform the > syscall on behalf of the process generating the notifiation. This > allows the file descriptor generated from that open call to be > returned to the calling process. > > In addition, there is funcitonality to allow for replacement of > specific file descriptors, following dup2-like semantics. > > Signed-off-by: Sargun Dhillon > Suggested-by: Matt Denton > Cc: Kees Cook , > Cc: Jann Horn , > Cc: Robert Sesek , > Cc: Chris Palmer > Cc: Christian Brauner > Cc: Tycho Andersen > --- Thanks, this is a really useful feature. Tested-by: Giuseppe Scrivano