From nobody Fri Feb 13 18:35:08 2026 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 CA2E384A22; Thu, 23 May 2024 21:23:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716499400; cv=none; b=SDRevRk63UcvejOfWhHds6QITR/knASd5sNfC6UffLrNcc3flplGjUv0B3GGB8HPkeR0h3JiHknzP/SHJ/8tl23+h8/CWGY2K2HsubHqqOE37jz+9BL7foOXCYES48hTKRjrxw3JnbaxFX4fKEcspwBGbyr9G/nS542eNybeK6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716499400; c=relaxed/simple; bh=XM0hUwOffQtWwO0Qz54AvVXTV1kQJiBoCu2GXssYZaE=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=aFwNDQkm1F4GZ7bRBfvQcKpK6LIypUPxW9u28OUXXYjlZmRiqjcbG6Sh/7zx06BZGjjwk/lvJBTm5f63rtTYii/4d4gP57X27+X45JRFiA1pWA9bCVV0vscMnE1mMmmOrLhDvO+6Vq2i9HdQTqR+CS/fAfMqsLvnivnt8joWhOY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88465C4AF09; Thu, 23 May 2024 21:23:20 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sAFuw-00000006l8j-1ene; Thu, 23 May 2024 17:24:06 -0400 Message-ID: <20240523212406.254317554@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 23 May 2024 17:23:00 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Masahiro Yamada , stable@vger.kernel.org Subject: [for-linus][PATCH 2/8] tracefs: Update inode permissions on remount References: <20240523212258.883756004@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" When a remount happens, if a gid or uid is specified update the inodes to have the same gid and uid. This will allow the simplification of the permissions logic for the dynamically created files and directories. Link: https://lore.kernel.org/linux-trace-kernel/20240523051539.592429986@g= oodmis.org Cc: stable@vger.kernel.org Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Cc: Masahiro Yamada Fixes: baa23a8d4360d ("tracefs: Reset permissions on remount if permissions= are options") Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/event_inode.c | 17 +++++++++++++---- fs/tracefs/inode.c | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 55a40a730b10..5dfb1ccd56ea 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -317,20 +317,29 @@ void eventfs_remount(struct tracefs_inode *ti, bool u= pdate_uid, bool update_gid) if (!ei) return; =20 - if (update_uid) + if (update_uid) { ei->attr.mode &=3D ~EVENTFS_SAVE_UID; + ei->attr.uid =3D ti->vfs_inode.i_uid; + } + =20 - if (update_gid) + if (update_gid) { ei->attr.mode &=3D ~EVENTFS_SAVE_GID; + ei->attr.gid =3D ti->vfs_inode.i_gid; + } =20 if (!ei->entry_attrs) return; =20 for (int i =3D 0; i < ei->nr_entries; i++) { - if (update_uid) + if (update_uid) { ei->entry_attrs[i].mode &=3D ~EVENTFS_SAVE_UID; - if (update_gid) + ei->entry_attrs[i].uid =3D ti->vfs_inode.i_uid; + } + if (update_gid) { ei->entry_attrs[i].mode &=3D ~EVENTFS_SAVE_GID; + ei->entry_attrs[i].gid =3D ti->vfs_inode.i_gid; + } } } =20 diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index a827f6a716c4..9252e0d78ea2 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -373,12 +373,21 @@ static int tracefs_apply_options(struct super_block *= sb, bool remount) =20 rcu_read_lock(); list_for_each_entry_rcu(ti, &tracefs_inodes, list) { - if (update_uid) + if (update_uid) { ti->flags &=3D ~TRACEFS_UID_PERM_SET; + ti->vfs_inode.i_uid =3D fsi->uid; + } =20 - if (update_gid) + if (update_gid) { ti->flags &=3D ~TRACEFS_GID_PERM_SET; - + ti->vfs_inode.i_gid =3D fsi->gid; + } + + /* + * Note, the above ti->vfs_inode updates are + * used in eventfs_remount() so they must come + * before calling it. + */ if (ti->flags & TRACEFS_EVENT_INODE) eventfs_remount(ti, update_uid, update_gid); } --=20 2.43.0