]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tracefs: Fix default permissions not being applied on initial mount
authorDavid Carlier <devnexen@gmail.com>
Sat, 4 Apr 2026 13:47:47 +0000 (14:47 +0100)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 8 Apr 2026 20:15:09 +0000 (16:15 -0400)
commite8368d1f4bedbb0cce4cfe33a1d2664bb0fd4f27
tree39f3e1251a5985d06158f215167d2d3420ffebd7
parent676540d02b2ca4c3a8e550156c72b760c08e387e
tracefs: Fix default permissions not being applied on initial mount

Commit e4d32142d1de ("tracing: Fix tracefs mount options") moved the
option application from tracefs_fill_super() to tracefs_reconfigure()
called from tracefs_get_tree(). This fixed mount options being ignored
on user-space mounts when the superblock already exists, but introduced
a regression for the initial kernel-internal mount.

On the first mount (via simple_pin_fs during init), sget_fc() transfers
fc->s_fs_info to sb->s_fs_info and sets fc->s_fs_info to NULL. When
tracefs_get_tree() then calls tracefs_reconfigure(), it sees a NULL
fc->s_fs_info and returns early without applying any options. The root
inode keeps mode 0755 from simple_fill_super() instead of the intended
TRACEFS_DEFAULT_MODE (0700).

Furthermore, even on subsequent user-space mounts without an explicit
mode= option, tracefs_apply_options(sb, true) gates the mode behind
fsi->opts & BIT(Opt_mode), which is unset for the defaults. So the
mode is never corrected unless the user explicitly passes mode=0700.

Restore the tracefs_apply_options(sb, false) call in tracefs_fill_super()
to apply default permissions on initial superblock creation, matching
what debugfs does in debugfs_fill_super().

Cc: stable@vger.kernel.org
Fixes: e4d32142d1de ("tracing: Fix tracefs mount options")
Link: https://patch.msgid.link/20260404134747.98867-1-devnexen@gmail.com
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
fs/tracefs/inode.c