lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <162403265988.528888.9996688190141639740.stgit@devnote2>
Date:   Sat, 19 Jun 2021 01:11:00 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     linux-kernel@...r.kernel.org,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-perf-users@...r.kernel.org
Subject: [PATCH 2/3] perf/probe: Show return probe correctly with --bootconfig

Since the bootconfig has to use "%return" suffix for the return
probes, perf probe also needs to add that suffix if the user
defines the return probe. E.g.

  $ perf probe -k vmlinux --bootconfig -D vfs_read%return
  ftrace.event.kprobes.vfs_read__return.probe = 'vfs_read+0%return'

Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
 tools/perf/util/probe-event.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 8e30bf97cf0f..99624e39314b 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2166,15 +2166,17 @@ synthesize_uprobe_trace_def(struct probe_trace_point *tp, struct strbuf *buf)
 }
 
 static int
-synthesize_kprobe_trace_def(struct probe_trace_point *tp, struct strbuf *buf)
+synthesize_kprobe_trace_def(struct probe_trace_point *tp, struct strbuf *buf,
+			    bool show_return)
 {
 	if (!strncmp(tp->symbol, "0x", 2)) {
 		/* Absolute address. See try_to_find_absolute_address() */
 		return strbuf_addf(buf, "%s%s0x%lx", tp->module ?: "",
 				  tp->module ? ":" : "", tp->address);
 	} else {
-		return strbuf_addf(buf, "%s%s%s+%lu", tp->module ?: "",
-				tp->module ? ":" : "", tp->symbol, tp->offset);
+		return strbuf_addf(buf, "%s%s%s+%lu%s", tp->module ?: "",
+				tp->module ? ":" : "", tp->symbol, tp->offset,
+				show_return && tp->retprobe ? "%return" : "");
 	}
 }
 
@@ -2195,7 +2197,7 @@ char *synthesize_probe_trace_command(struct probe_trace_event *tev)
 	if (tev->uprobes)
 		err = synthesize_uprobe_trace_def(tp, &buf);
 	else
-		err = synthesize_kprobe_trace_def(tp, &buf);
+		err = synthesize_kprobe_trace_def(tp, &buf, false);
 
 	if (err >= 0)
 		err = synthesize_probe_trace_args(tev, &buf);
@@ -3574,7 +3576,7 @@ static int show_bootconfig_event(struct probe_trace_event *tev)
 	if (strbuf_init(&buf, 32) < 0)
 		return -ENOMEM;
 
-	err = synthesize_kprobe_trace_def(tp, &buf);
+	err = synthesize_kprobe_trace_def(tp, &buf, true);
 	if (err >= 0)
 		err = synthesize_probe_trace_args(tev, &buf);
 	if (err >= 0)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ