Skip to content

tracing: Fix removing instances while reading/writing to their files

Steven Rostedt linux-trace-kernel lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6tracefs/eventfs: Use dput to free the toplevel events directoryfs/tracefs/event_inode.c fs/tracefs/inode.c fs/tracefs/internal.h+16 -85 replies
2/6tracing: Increase trace array ref count on enable and filter fileskernel/trace/trace.c kernel/trace/trace.h kernel/trace/trace_events.c+33 -20 replies
3/6tracing: Have tracing_max_latency inc the trace array ref countkernel/trace/trace.c+10 -50 replies
4/6tracing: Have current_trace inc the trace array ref countkernel/trace/trace.c+2 -10 replies
5/6tracing: Have option files inc the trace array ref countkernel/trace/trace.c+22 -10 replies
6/6tracing: Have event inject files inc the trace array ref countkernel/trace/trace_events_inject.c+2 -10 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by.

PatchLinux Kernel Functional TestingNaresh Kamboju
SeriesT-b T-b
1/6
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/6] tracing: Fix removing instances while reading/writing to their files

It appears that the dynamic code of eventfs has caused a race window to open up a bit more and showed that several files were not protected by the trace array ref count. This means that a task could open one of the files in an instance, remove the instance, and still be able to read or write to that file. That access will then cause a "use-after-free" bug.

Close those holes!

Also, fix a left over unused variable in the eventfs dput fix.

Steven Rostedt (Google) (6):
tracefs/eventfs: Use dput to free the toplevel events directory
tracing: Increase trace array ref count on enable and filter files
tracing: Have tracing_max_latency inc the trace array ref count
tracing: Have current_trace inc the trace array ref count
tracing: Have option files inc the trace array ref count
tracing: Have event inject files inc the trace array ref count

----

 fs/tracefs/event_inode.c           | 17 +++++++---
 fs/tracefs/inode.c                 |  2 +-
 fs/tracefs/internal.h              |  5 +--
 kernel/trace/trace.c               | 68 ++++++++++++++++++++++++++++++++++----
 kernel/trace/trace.h               |  2 ++
 kernel/trace/trace_events.c        |  6 ++--
 kernel/trace/trace_events_inject.c |  3 +-
 7 files changed, 85 insertions(+), 18 deletions(-)