Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3231446rdh; Thu, 28 Sep 2023 06:29:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDwoOB2c6yka0L0Ov5pL4K7YF862gU61LsbXKQiTPFJgdErSJijfH+bPfK500Rx2lr47Qt X-Received: by 2002:a17:902:e885:b0:1c5:59dc:6e93 with SMTP id w5-20020a170902e88500b001c559dc6e93mr2423209plg.3.1695907764245; Thu, 28 Sep 2023 06:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695907764; cv=none; d=google.com; s=arc-20160816; b=rsrnVG6ry18IjJlTYn1PUaylupSEvjN6k6A52ieOcSjGSd0RoRgVX26h4JUhydRfmE M1nt3rajAUBG/f+cGfJwHY1Cq13YiowhYt0p66P+3+w6Bv4I/cg71CTx04a9BZRvS0F+ sPSvwwiDzDU7I1AkpKQ28QGFSW4PUsdekZQGhwnxFM6E/MQ7WIPnn8MW3M0fC74/LCTf JarKqrfcQurInDhdbGyN6/t19IL4xAOT4S3jZeXW+nFCpMsNS9SkLtx8CYgRZi7Hz0jz Q7TRMkbliFziKwc28W6EL8L2zIliOvTMu0qwdo0sz7eRwQ8CKm9Fl7YgfFL4Bt+7T7y7 okIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Hw1kdCJHTUKyVQI8cwPwgA89Zea2YP/j5S8sNYlfyaA=; fh=6+EqM7nPvouFjv8urw662Pa2AXmD8AUl8AvbZ0ZiLLc=; b=m7CsV2F9Y53YUEUWc+ZrMWPIYOzkAKnMZzmcUy0SNsFXXGu1UWbFAR4eg0Oi/a1djD p/Ar2cZtolWvtmNinoD+MksRC5ZuPulZxWOaeUhoiuAwMXi+48zr5hmm7vQ0s4ku8JAb 4nkANIF3TLXphFhrSKhekfPAjMo3Ih2MOu/nDkuUpsO1uBEfO3ZUHxJn81X2Y0XMMtUy wSJZshjcCyTkutlEuqVUAhntMraRG+Vf27gCARdt5wpBzdr+DCpU3XHRFCwlqbdJhGqe rj4sc896/kY/4prj1rGMSmLtC4N53VHcvFphB2KxstGBfaFzyQ6IO1+B+Yk7OEkT+iSs oYjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dblYqe+y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id kx11-20020a170902f94b00b001c62acfa473si7968812plb.62.2023.09.28.06.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 06:29:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dblYqe+y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 031C48027A69; Thu, 28 Sep 2023 06:26:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbjI1N0D (ORCPT + 99 others); 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: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 28 Sep 2023 06:26:12 -0700 (PDT) > 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.