mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ftrace: fix the file mode of graph tracer and stack tracer
@ 2018-02-08  1:41 Zhengyuan Liu
  2018-02-08 15:21 ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Zhengyuan Liu @ 2018-02-08  1:41 UTC (permalink / raw)
  To: rostedt; +Cc: mingo, linux-kernel, liuzhengyuang521, linx.z.chen

It's something looks weird that those files could be written by root
but shows with no write permission by ll command.
Chen LinX <linx.z.chen@intel.com> has sent a similar patch to fix
graph function file mode in 2000,  I didn't get the reason why that
patch wasn't applied so I resend it.

Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
---
 kernel/trace/ftrace.c      | 4 ++--
 kernel/trace/trace_stack.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ccdf366..fe903dc8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5513,10 +5513,10 @@ static __init int ftrace_init_dyn_tracefs(struct dentry *d_tracer)
 	ftrace_create_filter_files(&global_ops, d_tracer);
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
-	trace_create_file("set_graph_function", 0444, d_tracer,
+	trace_create_file("set_graph_function", 0644, d_tracer,
 				    NULL,
 				    &ftrace_graph_fops);
-	trace_create_file("set_graph_notrace", 0444, d_tracer,
+	trace_create_file("set_graph_notrace", 0644, d_tracer,
 				    NULL,
 				    &ftrace_graph_notrace_fops);
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 734accc..4356f14 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -468,7 +468,7 @@ static __init int stack_trace_init(void)
 			NULL, &stack_trace_fops);
 
 #ifdef CONFIG_DYNAMIC_FTRACE
-	trace_create_file("stack_trace_filter", 0444, d_tracer,
+	trace_create_file("stack_trace_filter", 0644, d_tracer,
 			  &trace_ops, &stack_trace_filter_fops);
 #endif
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ftrace: fix the file mode of graph tracer and stack tracer
  2018-02-08  1:41 [PATCH] ftrace: fix the file mode of graph tracer and stack tracer Zhengyuan Liu
@ 2018-02-08 15:21 ` Steven Rostedt
  2018-02-09  2:33   ` [PATCH] ftrace: fix the file mode of graph tracer and stacktracer Zhengyuan Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2018-02-08 15:21 UTC (permalink / raw)
  To: Zhengyuan Liu; +Cc: mingo, linux-kernel, liuzhengyuang521, linx.z.chen

On Thu,  8 Feb 2018 09:41:53 +0800
Zhengyuan Liu <liuzhengyuan@kylinos.cn> wrote:

> It's something looks weird that those files could be written by root
> but shows with no write permission by ll command.
> Chen LinX <linx.z.chen@intel.com> has sent a similar patch to fix
> graph function file mode in 2000,  I didn't get the reason why that
> patch wasn't applied so I resend it.
> 
> Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
> ---
>  kernel/trace/ftrace.c      | 4 ++--
>  kernel/trace/trace_stack.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index ccdf366..fe903dc8 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -5513,10 +5513,10 @@ static __init int ftrace_init_dyn_tracefs(struct dentry *d_tracer)
>  	ftrace_create_filter_files(&global_ops, d_tracer);
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> -	trace_create_file("set_graph_function", 0444, d_tracer,
> +	trace_create_file("set_graph_function", 0644, d_tracer,

Thanks for resending the patch.

What's interesting is that this doesn't seem to affect whether or not
root can write to the file. I wonder if that's a bug itself.

-- Steve

>  				    NULL,
>  				    &ftrace_graph_fops);
> -	trace_create_file("set_graph_notrace", 0444, d_tracer,
> +	trace_create_file("set_graph_notrace", 0644, d_tracer,
>  				    NULL,
>  				    &ftrace_graph_notrace_fops);
>  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
> diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
> index 734accc..4356f14 100644
> --- a/kernel/trace/trace_stack.c
> +++ b/kernel/trace/trace_stack.c
> @@ -468,7 +468,7 @@ static __init int stack_trace_init(void)
>  			NULL, &stack_trace_fops);
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE
> -	trace_create_file("stack_trace_filter", 0444, d_tracer,
> +	trace_create_file("stack_trace_filter", 0644, d_tracer,
>  			  &trace_ops, &stack_trace_filter_fops);
>  #endif
>  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ftrace: fix the file mode of graph tracer and stacktracer
  2018-02-08 15:21 ` Steven Rostedt
@ 2018-02-09  2:33   ` Zhengyuan Liu
  2018-02-09  3:21     ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Zhengyuan Liu @ 2018-02-09  2:33 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: mingo, linux-kernel, liuzhengyuang521, linx.z.chen

2018-02-08 23:21 GMT+08:00 Steven Rostedt <rostedt@goodmis.org>:
> On Thu,  8 Feb 2018 09:41:53 +0800
> Zhengyuan Liu <liuzhengyuan@kylinos.cn> wrote:
>
>> It's something looks weird that those files could be written by root
>> but shows with no write permission by ll command.
>> Chen LinX <linx.z.chen@intel.com> has sent a similar patch to fix
>> graph function file mode in 2000,  I didn't get the reason why that
>> patch wasn't applied so I resend it.
>>
>> Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
>> ---
>>  kernel/trace/ftrace.c      | 4 ++--
>>  kernel/trace/trace_stack.c | 2 +-
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>> index ccdf366..fe903dc8 100644
>> --- a/kernel/trace/ftrace.c
>> +++ b/kernel/trace/ftrace.c
>> @@ -5513,10 +5513,10 @@ static __init int ftrace_init_dyn_tracefs(struct dentry *d_tracer)
>>       ftrace_create_filter_files(&global_ops, d_tracer);
>>
>>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>> -     trace_create_file("set_graph_function", 0444, d_tracer,
>> +     trace_create_file("set_graph_function", 0644, d_tracer,
>
> Thanks for resending the patch.
>
> What's interesting is that this doesn't seem to affect whether or not
> root can write to the file. I wonder if that's a bug itself.
>
> -- Steve

Hi, Steve, Thanks for reply.

It doesn't affect root writing to those files as root is a super user and
can access to any write-only files.  I just want to make those writable
file to look consistent with others, seeing bellow:

-rw-r--r--  1 root root  set_event_pid
-rw-r--r--  1 root root  set_ftrace_filter
-rw-r--r--  1 root root  set_ftrace_notrace
-rw-r--r--  1 root root  set_ftrace_pid
-r--r--r--  1 root root   set_graph_function
-r--r--r--  1 root root  set_graph_notrace

If this patch makes no sense, just ignore it!

>>                                   NULL,
>>                                   &ftrace_graph_fops);
>> -     trace_create_file("set_graph_notrace", 0444, d_tracer,
>> +     trace_create_file("set_graph_notrace", 0644, d_tracer,
>>                                   NULL,
>>                                   &ftrace_graph_notrace_fops);
>>  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
>> diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
>> index 734accc..4356f14 100644
>> --- a/kernel/trace/trace_stack.c
>> +++ b/kernel/trace/trace_stack.c
>> @@ -468,7 +468,7 @@ static __init int stack_trace_init(void)
>>                       NULL, &stack_trace_fops);
>>
>>  #ifdef CONFIG_DYNAMIC_FTRACE
>> -     trace_create_file("stack_trace_filter", 0444, d_tracer,
>> +     trace_create_file("stack_trace_filter", 0644, d_tracer,
>>                         &trace_ops, &stack_trace_filter_fops);
>>  #endif
>>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ftrace: fix the file mode of graph tracer and stacktracer
  2018-02-09  2:33   ` [PATCH] ftrace: fix the file mode of graph tracer and stacktracer Zhengyuan Liu
@ 2018-02-09  3:21     ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2018-02-09  3:21 UTC (permalink / raw)
  To: Zhengyuan Liu; +Cc: mingo, linux-kernel, liuzhengyuang521, linx.z.chen

On Fri, 9 Feb 2018 10:33:31 +0800
"Zhengyuan Liu" <liuzhengyuan@kylinos.cn> wrote:

> It doesn't affect root writing to those files as root is a super user and
> can access to any write-only files.  I just want to make those writable

Ah, I know when I vim a file that's read only, even for root vim will
complain. But there's no complaining with redirection.

I just tried vim on set_graph_function, and yeah, it does complain.

> file to look consistent with others, seeing bellow:
> 
> -rw-r--r--  1 root root  set_event_pid
> -rw-r--r--  1 root root  set_ftrace_filter
> -rw-r--r--  1 root root  set_ftrace_notrace
> -rw-r--r--  1 root root  set_ftrace_pid
> -r--r--r--  1 root root   set_graph_function
> -r--r--r--  1 root root  set_graph_notrace

Yeah, I understand.

> 
> If this patch makes no sense, just ignore it!

No no, it makes perfect sense. I plan on adding it. But it's not that
important to be included for stable. Expect to see this in 4.17.

Thanks!

-- Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-09  3:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08  1:41 [PATCH] ftrace: fix the file mode of graph tracer and stack tracer Zhengyuan Liu
2018-02-08 15:21 ` Steven Rostedt
2018-02-09  2:33   ` [PATCH] ftrace: fix the file mode of graph tracer and stacktracer Zhengyuan Liu
2018-02-09  3:21     ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome