Re: [PATCH 2/2] tracefs: Only clobber mode/uid/gid on remount if asked

From: Steven Rostedt
Date: Wed Sep 07 2022 - 18:44:53 EST


On Wed, 7 Sep 2022 14:53:42 -0700
Brian Norris <briannorris@xxxxxxxxxxxx> wrote:

> Try these:
>
> umount /sys/kernel/debug/tracing/
> grep tracefs /proc/mounts
> stat /sys/kernel/debug/tracing/.
> grep tracefs /proc/mounts
>
> The first and the second grep will give you different results.

How about this:

# grep tracefs /proc/mounts
tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0
tracefs /sys/kernel/debug/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0

# umount /sys/kernel/debug/tracing
# grep tracefs /proc/mounts
tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0

# ls /sys/kernel/debug/tracing
available_events hwlat_detector set_event_notrace_pid trace_clock
available_filter_functions instances set_event_pid trace_marker
available_tracers kprobe_events set_ftrace_filter trace_marker_raw
buffer_percent kprobe_profile set_ftrace_notrace trace_options
buffer_size_kb max_graph_depth set_ftrace_notrace_pid trace_pipe
buffer_total_size_kb options set_ftrace_pid trace_stat
current_tracer osnoise set_graph_function tracing_cpumask
dynamic_events per_cpu set_graph_notrace tracing_max_latency
dyn_ftrace_total_info printk_formats snapshot tracing_on
enabled_functions README stack_max_size tracing_thresh
error_log recursed_functions stack_trace uprobe_events
eval_map saved_cmdlines stack_trace_filter uprobe_profile
events saved_cmdlines_size synthetic_events user_events_data
free_buffer saved_tgids timestamp_mode user_events_status
function_profile_enabled set_event trace

# grep tracefs /proc/mounts
tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0
tracefs /sys/kernel/debug/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0

So it appears that accessing debugfs/tracing will automatically remount it.

Lean something new everyday! ;-)

-- Steve