All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] tracing: Fix synthetic event bug
@ 2022-10-11 21:25 Steven Rostedt
  2022-10-11 21:25 ` [PATCH 1/2] tracing: Move duplicate code of trace_kprobe/eprobe.c into header Steven Rostedt
  2022-10-11 21:25 ` [PATCH 2/2] tracing: Fix reading strings from synthetic events Steven Rostedt
  0 siblings, 2 replies; 4+ messages in thread
From: Steven Rostedt @ 2022-10-11 21:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Andrew Morton

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.


Steven Rostedt (Google) (2):
      tracing: Move duplicate code of trace_kprobe/eprobe.c into header
      tracing: Fix reading strings from synthetic events

----
 kernel/trace/trace_eprobe.c       | 60 ++----------------------
 kernel/trace/trace_events_synth.c | 28 +++++++++---
 kernel/trace/trace_kprobe.c       | 60 ++----------------------
 kernel/trace/trace_probe_kernel.h | 96 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 127 insertions(+), 117 deletions(-)
 create mode 100644 kernel/trace/trace_probe_kernel.h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-11 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 21:25 [PATCH 0/2] tracing: Fix synthetic event bug Steven Rostedt
2022-10-11 21:25 ` [PATCH 1/2] tracing: Move duplicate code of trace_kprobe/eprobe.c into header Steven Rostedt
2022-10-11 21:25 ` [PATCH 2/2] tracing: Fix reading strings from synthetic events Steven Rostedt
2022-10-11 21:58   ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.