tracing: stop command line recording when tracing is disabled
authorThomas Gleixner <tglx@linutronix.de>
Wed, 18 Mar 2009 07:56:58 +0000 (08:56 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 18 Mar 2009 09:10:16 +0000 (10:10 +0100)
Impact: prevent overwrite of command line entries

When the tracer is stopped the command line recording continues to
record. The check for tracing_is_on() is not sufficient here as the
ringbuffer status is not affected by setting
debug/tracing/tracing_enabled to 0. On a non idle system this can
result in the loss of the command line information for the stopped
trace, which makes the trace harder to read and analyse.

Check tracer_enabled to allow further recording.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace.c

index 1ce6208fd727205f25850e2ed13aa63265da76f0..7b6043ea256e9c7605ac31b47f1b05ef5946b271 100644 (file)
@@ -797,7 +797,8 @@ void trace_find_cmdline(int pid, char comm[])
 
 void tracing_record_cmdline(struct task_struct *tsk)
 {
-       if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on())
+       if (atomic_read(&trace_record_cmdline_disabled) || !tracer_enabled ||
+           !tracing_is_on())
                return;
 
        trace_save_cmdline(tsk);