Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1379563ybm; Sat, 30 May 2020 07:10:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy75RZ2NxEJjxb1FGbajnoC40D2pXdU83CUi5ygsWcIQ5PS6FwC/nTNM42PcfNvumu70t2K X-Received: by 2002:aa7:d6d1:: with SMTP id x17mr13529529edr.257.1590847855576; Sat, 30 May 2020 07:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590847855; cv=none; d=google.com; s=arc-20160816; b=b02BGEwViia1ijAd0lwhJZqR0BOntUYjeX/UkBPecuw+tHlc9prOE2uf8+g/6gJfeK 6UOGL8GRPa1Bd7K/8ni4iqXz31iWwcdyNBNfCjEMPov6fI/YfC5/kcF10M2BCDDOz8S7 oTOVYsj+6ednYVO2+K+32d4HTZblcu7LfEE7GFXzW8emsBD7/dwJDEf+0fCQuHZw9d4c jAMyrK6LyLN3jFES0pAtiXB5JPJoAHpGyuP+frorQVXqEyV7swZYRUbtERZEkneHaSQc xsDJ7iDca1nNuV7VrTM4xa6aOb0v48/ReBCP6hrABZ49wDdPgimJR4MWRIvRmexIqzJ1 6pzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=6zvcGVTYkSID+S08W0x1fWC5GWQ13bCWSQ0BcT6suYY=; b=b0+Ym3TwYipDrg9cey49gNWWtPexdzI/o3RKcrRuV2e9l/O13qZNgwKKfBW4WMhPZd oFBPlqtGZbURdJ2wMaqkyqzwQKKrLjs2r3BhvjV9wMo1kHFPXi7feUXdwlulMuwFV04G UyP3lZPBQfvSlBf3nUB66n2340WXS2TOuwcvrc84FBCYBJvFzOpDurh+/IOXvIhjFMDb 1B4W4t3uV6mrCzoghbk0WQF1DfSXNtO7jq1erxZvFi3xZmPNkPydOmKhY6gRS84BrMNU N2qNfFvV99grpkCpGvtQfXSsAjSWj8v1aoAc3Zt05j8T8BLu7FY9Tj8CYtXlT9k4BE3/ ONsw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si6930737edx.79.2020.05.30.07.10.31; Sat, 30 May 2020 07:10:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728999AbgE3OIu (ORCPT + 99 others); Sat, 30 May 2020 10:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727851AbgE3OIt (ORCPT ); Sat, 30 May 2020 10:08:49 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3933C03E969; Sat, 30 May 2020 07:08:49 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.93 #3 (Red Hat Linux)) id 1jf2A9-000SbL-Rj; Sat, 30 May 2020 14:08:38 +0000 Date: Sat, 30 May 2020 15:08:37 +0100 From: Al Viro To: Kees Cook Cc: Sargun Dhillon , christian.brauner@ubuntu.com, containers@lists.linux-foundation.org, cyphar@cyphar.com, jannh@google.com, jeffv@google.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, palmer@google.com, rsesek@google.com, tycho@tycho.ws, Matt Denton Subject: Re: [PATCH v2 2/3] seccomp: Introduce addfd ioctl to seccomp user notifier Message-ID: <20200530140837.GM23230@ZenIV.linux.org.uk> References: <20200528110858.3265-1-sargun@sargun.me> <20200528110858.3265-3-sargun@sargun.me> <202005282345.573B917@keescook> <20200530011054.GA14852@ircssh-2.c.rugged-nimbus-611.internal> <202005291926.E9004B4@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202005291926.E9004B4@keescook> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 29, 2020 at 07:43:10PM -0700, Kees Cook wrote: > Can anyone clarify the expected failure mode from SCM_RIGHTS? Can we > move the put_user() after instead? I think cleanup would just be: > replace_fd(fd, NULL, 0) Bollocks. Repeat after me: descriptor tables can be shared. There is no "cleanup" after you've put something there. If you do not get it, you have no business messing with any of this stuff.