• Steven Rostedt (Google)'s avatar
    tracing: Stop current tracer when resizing buffer · d78ab792
    Steven Rostedt (Google) authored
    When the ring buffer is being resized, it can cause side effects to the
    running tracer. For instance, there's a race with irqsoff tracer that
    swaps individual per cpu buffers between the main buffer and the snapshot
    buffer. The resize operation modifies the main buffer and then the
    snapshot buffer. If a swap happens in between those two operations it will
    break the tracer.
    
    Simply stop the running tracer before resizing the buffers and enable it
    again when finished.
    
    Link: https://lkml.kernel.org/r/20231205220010.748996423@goodmis.org
    
    Cc: stable@vger.kernel.org
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Fixes: 3928a8a2 ("ftrace: make work with new ring buffer")
    Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    d78ab792
trace.c 259 KB