Patch "tracing: Allocate the snapshot buffer before enabling probe" has been added to the 4.10-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
tracing: Allocate the snapshot buffer before enabling probe
to the 4.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
tracing-allocate-the-snapshot-buffer-before-enabling-probe.patch
and it can be found in the queue-4.10 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
df62db5be2e5f070ecd1a5ece5945b590ee112e0Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (VMware)" <[email protected]>
Date: Wed, 19 Apr 2017 12:07:08 -0400
Subject: tracing: Allocate the snapshot buffer before enabling probe
From: Steven Rostedt (VMware) <[email protected]>
commit df62db5be2e5f070ecd1a5ece5945b590ee112e0 upstream.
Currently the snapshot trigger enables the probe and then allocates the snapshot. If the probe triggers before the allocation, it could cause the snapshot to fail and turn tracing off. It's best to allocate the snapshot buffer first, and then enable the trigger. If something goes wrong in the enabling of the trigger, the snapshot buffer is still allocated, but it can also be freed by the user by writting zero into the snapshot buffer file.
Also add a check of the return status of alloc_snapshot().
--- kernel/trace/trace.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/trace/trace.c +5 -3
@@ -6740,11 +6740,13 @@ ftrace_trace_snapshot_callback(struct ftreturn ret; out_reg: - ret =register_ftrace_function_probe (glob, ops, count); + ret =alloc_snapshot (&global_trace); +if (ret <0 ) + goto out; -if (ret >=0 ) -alloc_snapshot (&global_trace); + ret =register_ftrace_function_probe (glob, ops, count); + out:return ret <0 ? ret :0 ; }
Patches currently in stable-queue which might be from [email protected] are
queue-4.10/tracing-allocate-the-snapshot-buffer-before-enabling-probe.patch queue-4.10/ring-buffer-have-ring_buffer_iter_empty-return-true-when-empty.patch