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=-3.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 1BC9CC433E1 for ; Tue, 7 Jul 2020 11:49:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03E13206F6 for ; Tue, 7 Jul 2020 11:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728901AbgGGLt2 (ORCPT ); Tue, 7 Jul 2020 07:49:28 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:37981 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727116AbgGGLt1 (ORCPT ); Tue, 7 Jul 2020 07:49:27 -0400 Received: from ip5f5af08c.dynamic.kabel-deutschland.de ([95.90.240.140] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jsm6G-0004ZI-Uh; Tue, 07 Jul 2020 11:49:25 +0000 Date: Tue, 7 Jul 2020 13:49:23 +0200 From: Christian Brauner 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: <20200707114923.6huxnb4e5vkl657a@wittgenstein> References: <20200706201720.3482959-1-keescook@chromium.org> <20200706201720.3482959-4-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200706201720.3482959-4-keescook@chromium.org> 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. > > Reviewed-by: Sargun Dhillon > Signed-off-by: Kees Cook > --- Hm, I'm not sure why 2/7 and 3/7 aren't just one patch but ok. :) Acked-by: Christian Brauner