From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C280C433E2 for ; Tue, 7 Jul 2020 06:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37F6A20702 for ; Tue, 7 Jul 2020 06:49:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728295AbgGGGtg (ORCPT ); Tue, 7 Jul 2020 02:49:36 -0400 Received: from verein.lst.de ([213.95.11.211]:57382 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbgGGGtf (ORCPT ); Tue, 7 Jul 2020 02:49:35 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 0629668B05; Tue, 7 Jul 2020 08:49:32 +0200 (CEST) Date: Tue, 7 Jul 2020 08:49:31 +0200 From: Christoph Hellwig To: Kees Cook Cc: linux-kernel@vger.kernel.org, Sargun Dhillon , Christian Brauner , Tycho Andersen , David Laight , Christoph Hellwig , "David S. Miller" , Jakub Kicinski , Alexander Viro , Aleksa Sarai , Matt Denton , Jann Horn , Chris Palmer , Robert Sesek , Giuseppe Scrivano , Greg Kroah-Hartman , Andy Lutomirski , Will Drewry , Shuah Khan , netdev@vger.kernel.org, containers@lists.linux-foundation.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v6 3/7] fs: Add receive_fd() wrapper for __receive_fd() Message-ID: <20200707064931.GB23649@lst.de> References: <20200706201720.3482959-1-keescook@chromium.org> <20200706201720.3482959-4-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200706201720.3482959-4-keescook@chromium.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 06, 2020 at 01:17:16PM -0700, Kees Cook wrote: > For both pidfd and seccomp, the __user pointer is not used. Update > __receive_fd() to make writing to ufd optional via a NULL check. However, > for the receive_fd_user() wrapper, ufd is NULL checked so an -EFAULT > can be returned to avoid changing the SCM_RIGHTS interface behavior. Add > new wrapper receive_fd() for pidfd and seccomp that does not use the ufd > argument. For the new helper, the allocated fd needs to be returned on > success. Update the existing callers to handle it. Oh here we go, I'll take the last comment back.