Skip to content

tracing: Fix how the tracer options file ups the trace_array ref count

Steven Rostedt linux-trace-kernel lkml stable 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2tracing: Use a single array to represent tracer options fileskernel/trace/trace.c kernel/trace/trace.h+27 -410 replies
2/2tracing: Take trace_array reference when opening a tracer options filekernel/trace/trace.c+33 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] tracing: Fix how the tracer options file ups the trace_array ref count

Sashiko reported that the tracer option files pass a descriptor to the file system operations that points to the trace_array it is apart of as well as information on the tracer option. It uses the trace_array to up its reference counter so that it can not be deleted when the option is open. The issue is that this descriptor sent to the open call itself can be removed by the removal of the instance the trace_array represents. There's nothing protecting it for going away and dereferencing it after it has been freed.

Another issue is that the tracer options are an array on an array for each tracer in the trace_array descriptor. The first patch converts that to a single array. This is need for the second patch.

The second patch changes the open function to search all the existing trace_arrays under lock and compare their topts array with the topt passed to the open function. If the topt is within the range of a trace_array topts array then that trace_array is considered a match and its reference is updated.

Steven Rostedt (2):
tracing: Use a single array to represent tracer options files
tracing: Take trace_array reference when opening a tracer options file

----

 kernel/trace/trace.c | 81 +++++++++++++++++++++++++++++++++-------------------
 kernel/trace/trace.h | 21 ++++++--------
 2 files changed, 60 insertions(+), 42 deletions(-)