tracing/probes: Reject symbol/symstr type for uprobe
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Mon, 14 Nov 2022 04:47:56 +0000 (13:47 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Thu, 15 Dec 2022 00:00:20 +0000 (09:00 +0900)
commitd4505aa6afae17a20c2f3ccfbfb7a07881b7ae02
treefe4de1b85fc786acf5b5d89bc253879bf5fde03f
parentb26a124cbfa80f42bfc4e63e1d5643ca98159d66
tracing/probes: Reject symbol/symstr type for uprobe

Since uprobe's argument must contain the user-space data, that
should not be converted to kernel symbols. Reject if user
specifies these types on uprobe events. e.g.

 /sys/kernel/debug/tracing # echo 'p /bin/sh:10 %ax:symbol' >> uprobe_events
 sh: write error: Invalid argument
 /sys/kernel/debug/tracing # echo 'p /bin/sh:10 %ax:symstr' >> uprobe_events
 sh: write error: Invalid argument
 /sys/kernel/debug/tracing # cat error_log
 [ 1783.134883] trace_uprobe: error: Unknown type is specified
   Command: p /bin/sh:10 %ax:symbol
                             ^
 [ 1792.201120] trace_uprobe: error: Unknown type is specified
   Command: p /bin/sh:10 %ax:symstr
                             ^
Link: https://lore.kernel.org/all/166679931679.1528100.15540755370726009882.stgit@devnote3/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
kernel/trace/trace_probe.c
kernel/trace/trace_probe.h
kernel/trace/trace_uprobe.c
tools/testing/selftests/ftrace/test.d/kprobe/uprobe_syntax_errors.tc