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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07AF2E732D0 for ; Thu, 28 Sep 2023 13:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231867AbjI1N0D (ORCPT ); Thu, 28 Sep 2023 09:26:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230420AbjI1N0C (ORCPT ); Thu, 28 Sep 2023 09:26:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB60319B; Thu, 28 Sep 2023 06:26:00 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B9FDC433C8; Thu, 28 Sep 2023 13:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695907560; bh=Hw1kdCJHTUKyVQI8cwPwgA89Zea2YP/j5S8sNYlfyaA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dblYqe+yhoU6HknPuT1Li7tqtIHqkPT31Fqgr9cM035dTtSl+V/SnVA2/hLqrVpL0 1A+90K64uvNwVjYEMnbgsKqZvysTvJsMZq95Qqd+f7F9/M5forItau/PMFJBSv3qfe /s51Fc3utpAfHRRTkZ6XQ/3eKy812zBXIRMg3FKmJBF6BvHf9SCxbynp/nnUaUxYXV PS8WG1Yh3AheIdqxO06HfN+24LUrexjlE4J2EnsrgZ2r8ZS3tvsZFfH18tw3pLak3H ed2WmB/sYUtWYJEMozJ5EfQvBUl/NhVMpMoWTUtBixZG1uNcaumlL0hcPsFfxDi1XX OetJ6nyiXiqnA== Date: Thu, 28 Sep 2023 15:25:56 +0200 From: Christian Brauner To: Linus Torvalds Cc: Mateusz Guzik , viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2] vfs: shave work on failed file open Message-ID: <20230928-kulleraugen-restaurant-dd14e2a9c0b0@brauner> References: <20230926162228.68666-1-mjguzik@gmail.com> <20230927-kosmetik-babypuppen-75bee530b9f0@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Which all seems to be the case already, so with the put_cred() not > needing the RCU delay, I thing we really could do this patch (note: So I spent a good chunk of time going through this patch. Before file->f_cred was introduced file->f_{g,u}id would have been accessible just under rcu protection. And file->f_cred->f_fs{g,u}id replaced that access. So I think the intention was that file->f_cred would function the same way, i.e., it would be possible to go from file to cred under rcu without requiring a reference. But basically, file->f_cred is the only field that would give this guarantee. Other pointers such as file->f_security (security_file_free()) don't and are freed outside of the rcu delay already as well. This patch means that if someone wants to access file->f_cred under rcu they now need to call get_file_rcu() first. Nothing has relied on this rcu-only file->f_cred quirk/feature until now so I think it's fine to change it. Does that make sense? Please take a look at: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs.misc&id=e3f15ee79197fc8b17d3496b6fa4fa0fc20f5406 for testing.