diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-05-07 11:49:35 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-05-07 11:49:35 -0400 |
commit | d6bf81ef0f7474434c2a049e8bf3c9146a14dd96 (patch) | |
tree | b2868093d4812c628a6752b1995491131cb08bc8 /kernel/trace/trace_events.c | |
parent | 29c8000ee7da3a6756d26143991e573eaaf2a9f6 (diff) |
tracing: append ":*" to internal setting of system events
The system enabling of events uses the same code as the set_event file.
It passes in the name of the system to the parser and that will enable
all the events that has that system as a name.
The problem is that it will also enable events with the same name as the
system.
If you have system name foo, and system name bar, but within the system
bar, there exists an event called foo. By setting the system name foo,
you will also be enabling the event foo in the system bar. This is not
an expected result.
The solution is to pass in "foo:*", which will only enable the system
foo and not events called foo.
[ Impact: prevent accidental enabling of events with same name as a system ]
Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 87feb0117ce2..8d0fae3af595 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -509,9 +509,11 @@ system_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
509 | return -EINVAL; | 509 | return -EINVAL; |
510 | } | 510 | } |
511 | 511 | ||
512 | command = kstrdup(system, GFP_KERNEL); | 512 | /* +3 for the ":*\0" */ |
513 | command = kmalloc(strlen(system)+3, GFP_KERNEL); | ||
513 | if (!command) | 514 | if (!command) |
514 | return -ENOMEM; | 515 | return -ENOMEM; |
516 | sprintf(command, "%s:*", system); | ||
515 | 517 | ||
516 | ret = ftrace_set_clr_event(command, val); | 518 | ret = ftrace_set_clr_event(command, val); |
517 | if (ret) | 519 | if (ret) |
@@ -1179,7 +1181,7 @@ static __init int event_trace_init(void) | |||
1179 | &ftrace_show_header_fops); | 1181 | &ftrace_show_header_fops); |
1180 | 1182 | ||
1181 | trace_create_file("enable", 0644, d_events, | 1183 | trace_create_file("enable", 0644, d_events, |
1182 | "*:*", &ftrace_system_enable_fops); | 1184 | "*", &ftrace_system_enable_fops); |
1183 | 1185 | ||
1184 | for_each_event(call, __start_ftrace_events, __stop_ftrace_events) { | 1186 | for_each_event(call, __start_ftrace_events, __stop_ftrace_events) { |
1185 | /* The linker may leave blanks */ | 1187 | /* The linker may leave blanks */ |