Skip to contentSkip to conversation

tracing: fix file mode of trace and README

PATCH In review Li Zefan 2 participants 4 messages Apr 17, 2009 Tracing

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 tracing: fix file mode of trace and README

trace is read-write and README is read-only.

---
 kernel/trace/trace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
index 031c46f..f681f64 100644
@@ -4002,7 +4002,7 @@ static __init int tracer_init_debugfs(void)
 	trace_create_file("available_tracers", 0444, d_tracer,
 			&global_trace, &show_traces_fops);
 
-	trace_create_file("current_tracer", 0444, d_tracer,
+	trace_create_file("current_tracer", 0644, d_tracer,
 			&global_trace, &set_tracer_fops);
 
 	trace_create_file("tracing_max_latency", 0644, d_tracer,
@@ -4011,7 +4011,7 @@ static __init int tracer_init_debugfs(void)
 	trace_create_file("tracing_thresh", 0644, d_tracer,
 			&tracing_thresh, &tracing_max_lat_fops);
 
-	trace_create_file("README", 0644, d_tracer,
+	trace_create_file("README", 0444, d_tracer,
 			NULL, &tracing_readme_fops);
 
 	trace_create_file("trace_pipe", 0444, d_tracer,
Signature · 1 line
1.5.4.rc3
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Li Zefan

trace is read-write and README is read-only.

---
 kernel/trace/trace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +0 -0
index 031c46f..f681f64 100644

kernel/trace/trace.c static __init int tracer_init_debugfs(void) · line 4006

Quoted 6 lines
kernel/trace/trace.c +1 -1
@@ -4002,7 +4002,7 @@ static __init int tracer_init_debugfs(void)
 	trace_create_file("available_tracers", 0444, d_tracer,
 			&global_trace, &show_traces_fops);
 
-	trace_create_file("current_tracer", 0444, d_tracer,
+	trace_create_file("current_tracer", 0644, d_tracer,
 			&global_trace, &set_tracer_fops);

Oh!
I wonder how much time we ran with this false permission. It clearly shows a bug in debugfs permission (or something near this this layer), we have be running with this file for a while and I've never seen any issue while writing into it.

And we have seen several patches with 0444 permissions for the tracing tree containing writeable files, showing that the authors ran them whithout problems.

Adding Greg in Cc.

kernel/trace/trace.c static __init int tracer_init_debugfs(void) · line 4015

Quoted 9 lines
kernel/trace/trace.c +1 -1
 	trace_create_file("tracing_max_latency", 0644, d_tracer,
@@ -4011,7 +4011,7 @@ static __init int tracer_init_debugfs(void)
 	trace_create_file("tracing_thresh", 0644, d_tracer,
 			&tracing_thresh, &tracing_max_lat_fops);
 
-	trace_create_file("README", 0644, d_tracer,
+	trace_create_file("README", 0444, d_tracer,
 			NULL, &tracing_readme_fops);

At least this one was harmless, but still it fixes the correctness.

Thanks,

Quoted 4 lines
kernel/trace/trace.c +0 -0
 	trace_create_file("trace_pipe", 0444, d_tracer,
Signature · 1 line
1.5.4.rc3
author
#2 lore raw
Quoted 13 lines

kernel/trace/trace.c static __init int tracer_init_debugfs(void) · line 4006

Quoted 4 lines
kernel/trace/trace.c +1 -1
-	trace_create_file("current_tracer", 0444, d_tracer,
+	trace_create_file("current_tracer", 0644, d_tracer,
 			&global_trace, &set_tracer_fops);

Oh!
I wonder how much time we ran with this false permission. It clearly shows a bug in debugfs permission (or something near this this layer), we have be running with this file for a while and I've never seen any issue while writing into it.

Quoted 4 lines

And we have seen several patches with 0444 permissions for the tracing tree containing writeable files, showing that the authors ran them whithout problems.

It's not a bug in debugfs or vfs. It's just because root can do anything. ;)

Quoted 2 lines

Adding Greg in Cc.

#3 lore raw
In reply to Li Zefan
Commit-ID:  339ae5d3c3fc2025e3657637921495fd600027c7
Gitweb:     http://git.kernel.org/tip/339ae5d3c3fc2025e3657637921495fd600027c7
Author:     Li Zefan <[email protected]>
AuthorDate: Fri, 17 Apr 2009 10:34:30 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 17 Apr 2009 18:04:36 +0200

tracing: fix file mode of trace and README

trace is read-write and README is read-only.

[ Impact: fix /debug/tracing/ file permissions. ]

LKML-Reference: <[email protected]>

---
 kernel/trace/trace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
index 031c46f..f681f64 100644
@@ -4002,7 +4002,7 @@ static __init int tracer_init_debugfs(void)
 	trace_create_file("available_tracers", 0444, d_tracer,
 			&global_trace, &show_traces_fops);
 
-	trace_create_file("current_tracer", 0444, d_tracer,
+	trace_create_file("current_tracer", 0644, d_tracer,
 			&global_trace, &set_tracer_fops);
 
 	trace_create_file("tracing_max_latency", 0644, d_tracer,
@@ -4011,7 +4011,7 @@ static __init int tracer_init_debugfs(void)
 	trace_create_file("tracing_thresh", 0644, d_tracer,
 			&tracing_thresh, &tracing_max_lat_fops);
 
-	trace_create_file("README", 0644, d_tracer,
+	trace_create_file("README", 0444, d_tracer,
 			NULL, &tracing_readme_fops);
 
 	trace_create_file("trace_pipe", 0444, d_tracer,