diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-17 00:20:15 +0100 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-17 04:27:06 +0100 |
commit | 4ca530852346be239b7c19e7bec5d2b78855bebe (patch) | |
tree | 96e5252faaf362115a96ed6df7c4e4f698a027dc /kernel/trace/trace_functions_graph.c | |
parent | tracing/ftrace: fix the check on nopped sites (diff) | |
download | linux-4ca530852346be239b7c19e7bec5d2b78855bebe.tar.xz linux-4ca530852346be239b7c19e7bec5d2b78855bebe.zip |
tracing: protect reader of cmdline output
Impact: fix to one cause of incorrect comm outputs in trace
The spinlock only protected the creation of a comm <=> pid pair.
But it was possible that a reader could look up a pid, and get the
wrong comm because it had no locking.
This also required changing trace_find_cmdline to copy the comm cache
and not just send back a pointer to it.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 4c388607ed67..6004ccac2dd7 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -190,15 +190,15 @@ print_graph_cpu(struct trace_seq *s, int cpu) static enum print_line_t print_graph_proc(struct trace_seq *s, pid_t pid) { - int i; - int ret; - int len; - char comm[8]; - int spaces = 0; + char comm[TASK_COMM_LEN]; /* sign + log10(MAX_INT) + '\0' */ char pid_str[11]; + int spaces = 0; + int ret; + int len; + int i; - strncpy(comm, trace_find_cmdline(pid), 7); + trace_find_cmdline(pid, comm); comm[7] = '\0'; sprintf(pid_str, "%d", pid); |