Skip to content

tracing: Fix synthetic event bug

Steven Rostedt lkml stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 4 repliesIn review
  2. v12 patches 1 replySuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tracing: Move duplicate code of trace_kprobe/eprobe.c into headerkernel/trace/trace_eprobe.c kernel/trace/trace_kprobe.c kernel/trace/trace_probe_kernel.h+106 -1100 replies
2/3tracing: Add "(fault)" name injection to kernel probeskernel/trace/trace_probe_kernel.h+25 -62 replies
3/3tracing: Fix reading strings from synthetic eventskernel/trace/trace_events_synth.c+17 -60 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMasami Hiramatsu (Google)Tom Zanussi
SeriesA-b R-b
1/3
2/3
3/3

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

Read the v2 thread

Cover letter [PATCH v2 0/3] tracing: Fix synthetic event bug

The follow commands caused a crash:

  # cd /sys/kernel/tracing
  # echo 's:open char file[]' > dynamic_events
  # echo 'hist:keys=common_pid:file=filename:onchange($file).trace(open,$file)' > events/syscalls/sys_enter_openat/trigger'
  # echo 1 > events/synthetic/open/enable

BOOM!

The problem is that the synthetic event field "char file[]" will read the value given to it as a string without any memory checks to make sure the address is valid. The above example will pass in the user space address and the sythetic event code will happily call strlen() on it and then strscpy() where either one will cause an oops when accessing user space addresses.

Changes since v1: https://lore.kernel.org/all/[email protected]/

- Handle "(fault)" printing when there's a fault

Steven Rostedt (Google) (3):
tracing: Move duplicate code of trace_kprobe/eprobe.c into header
tracing: Add "(fault)" name injection to kernel probes
tracing: Fix reading strings from synthetic events

----

 kernel/trace/trace_eprobe.c       |  60 ++------------------
 kernel/trace/trace_events_synth.c |  23 ++++++--
 kernel/trace/trace_kprobe.c       |  60 ++------------------
 kernel/trace/trace_probe_kernel.h | 115 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 142 insertions(+), 116 deletions(-)
 create mode 100644 kernel/trace/trace_probe_kernel.h