Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7325610rdb; Wed, 3 Jan 2024 11:52:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiymy+aEU5qd/Qbsiww9Qx3tJ0cX6SbKaMUR7H61ndLeOCXnlqhUksBS4HL/SQ+kcbNDFu X-Received: by 2002:a17:90a:fb8b:b0:28c:1c30:aaac with SMTP id cp11-20020a17090afb8b00b0028c1c30aaacmr5567626pjb.70.1704311536167; Wed, 03 Jan 2024 11:52:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704311536; cv=none; d=google.com; s=arc-20160816; b=EnWOTFc0KfFEncbArN1X8D6KLR86nfEZN1HIxWeTXr6VigBYhIafIw147xpYK6MNG1 qSvrv36m9kabR7bh9c/lGIIjI8e80xTu94n03Jcd2ysdo1gJMZM10R4MdUD3YFRrIkGg bwb5nT0/cMXnpZ2p1YMWNWGfmzEPUZgTALiqxYz/WHCJOEX3CXjtlr8ScWwqc7Mp8NXb AbqGING48b1rk0iRsuQSokmevgnHlOlijEaQWdUU7Rl6edrdeyRhs2PjX4a5r1Xgxhno 1pP+vkoUa07Z1UBziKh977FopNOBntJfgU2Q+0npXy8gxhBJTBi6X7gB19FHh2MXQOZD 0Lsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=jMEuvA9RBTsjiAJdoPik6yoqMDfIb90H+w/yf3KXh+Q=; fh=3rua1hLH3XxQMFm/tHd6Rm+NVbWbtu+PwwssIXSahaU=; b=whF/FsamzDGFfleuLZmL8M5HkSMFkxGdpexJD9QdXIOcwBFHMVJzlQV9izKeu1DQqk vAym6t5jbSQXmDhIrAhJe5JkIw1iRdVZAYa0r5Va6PxoBLMNGMuJDihjLI+8sJRTwhzR odq9eVemt9eOcU777JQYQn4udHFfdfD4Q9kBW7gIxZ3gSbl7APC2Q54SPrR4hMIZ4wCW d8g5DmF7mFgUMxKFKMaSh6mQsgjhN2Yo832wCo3tqR1LhVgpD/ndmCyXv7mWjxLxWzM0 23EuqpSXWSbIYBTImEJzQ6q61bFDwM+4YkT+ZCKfmeL4toNW8MjYry7pMYds8SsYRdex eOWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15937-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15937-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bh21-20020a17090b049500b0028bde0db2e0si1691161pjb.144.2024.01.03.11.52.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 11:52:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15937-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15937-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15937-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CD18928251E for ; Wed, 3 Jan 2024 19:52:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9CD51CFB2; Wed, 3 Jan 2024 19:52:04 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 765221D525; Wed, 3 Jan 2024 19:52:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0594C433C7; Wed, 3 Jan 2024 19:52:02 +0000 (UTC) Date: Wed, 3 Jan 2024 14:53:06 -0500 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Linux Trace Kernel , Masami Hiramatsu , Mathieu Desnoyers , Al Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH] eventfs: Stop using dcache_readdir() for getdents() Message-ID: <20240103145306.51f8a4cd@gandalf.local.home> In-Reply-To: References: <20240103102553.17a19cea@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 3 Jan 2024 10:38:09 -0800 Linus Torvalds wrote: > @@ -332,10 +255,8 @@ static int tracefs_apply_options(struct super_block *sb, bool remount) > if (!remount || opts->opts & BIT(Opt_uid)) > inode->i_uid = opts->uid; > > - if (!remount || opts->opts & BIT(Opt_gid)) { > - /* Set all the group ids to the mount option */ > - set_gid(sb->s_root, opts->gid); > - } > + if (!remount || opts->opts & BIT(Opt_gid)) > + inode->i_gid = opts->gid; > > return 0; > } This doesn't work because for tracefs (not eventfs) the dentries are created at boot up and before the file system is mounted. This means you can't even set a gid in /etc/fstab. This will cause a regression. tracefs was designed after debugfs, which also ignores gid. But because there's users out there that want non-root accounts to have access to tracing, it is documented to set the gid to a group that you can then add users to. And that's the reason behind the set_gid() walk. Reverting that one commit won't fix things either, because it only blocked OTH to be read, but the creation of the files changed their mode's passed to block OTH as well, so all those would need to be changed too. And I don't think making the trace files open to OTH is a good solution, even if the tracefs top level directory itself blocks other. The issue was that the user use to just mount the top level to allow the group access to the files below, which allowed all users access. But this is weak control of the file system. Even my non-test machines have me in the tracing group so my user account has access to tracefs. On boot up, all the tracefs files are created via tracefs_create_file() and directories by tracefs_create_dir() which was copied from debugfs_create_file/dir(). At this moment, the dentry is created with the permissions set. There's no looking at the super block. So we need a way to change the permissions at mount time. The only solution I can think of that doesn't include walking the current dentries, is to convert all of tracefs to be more like eventfs, and have the dentries created on demand. But perhaps, different than eventfs, they do not need to be freed when they are no longer referenced, which should make it easier to implement. And there's not nearly as many files and directories, so keeping meta data around isn't as much of an issue. Instead of creating the inode and dentry in the tracefs_create_file/dir(), it could just create a descriptor that holds the fops, data and mode. Then on lookup, it would create the inodes and dentries similar to eventfs. It would need its own iterate_shared as well. -- Steve