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: <20140123022959.7206.75914.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp>
Date:	Thu, 23 Jan 2014 02:29:59 +0000
From:	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
	David Ahern <dsahern@...il.com>, linux-kernel@...r.kernel.org,
	"Steven Rostedt (Red Hat)" <rostedt@...dmis.org>,
	Oleg Nesterov <oleg@...hat.com>,
	Ingo Molnar <mingo@...hat.com>,
	"David A. Long" <dave.long@...aro.org>,
	yrl.pp-manager.tt@...achi.com, Namhyung Kim <namhyung@...nel.org>
Subject: [PATCH -tip 6/8] perf-probe: Show symbol+offset for address only
 kprobes

Show the symbol+offset information for address only kprobe
events when --list operation without debuginfo. Currently
those events are shown by the address itself. With this change
perf probe finds symbols on those addresses and shows it.

E.g. without this change (when debuginfo is not available);
# ./perf probe -l
  probe:t_show         (on 0xffffffff810d9720 with m v)
  probe:t_show_1       (on 0xffffffff810e2e40 with m v t)
  probe:t_show_2       (on 0xffffffff810ece30 with m v fmt)
  probe:t_show_3       (on 0xffffffff810f4ad0 with m v file)

With this change;
# ./perf probe -l
  probe:t_show         (on t_show with m v)
  probe:t_show_1       (on t_show with m v t)
  probe:t_show_2       (on t_show with m v fmt)
  probe:t_show_3       (on t_show with m v file)

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
---
 tools/perf/util/probe-event.c |   35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 3470934..bf1d73b 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -118,6 +118,7 @@ static void exit_symbol_maps(void)
 	symbol__exit();
 }
 
+/* Caller must call init_symbol_maps before use this */
 static struct symbol *__find_kernel_function_by_name(const char *name,
 						     struct map **mapp)
 {
@@ -125,6 +126,12 @@ static struct symbol *__find_kernel_function_by_name(const char *name,
 						     NULL);
 }
 
+/* Caller must call init_symbol_maps before use this */
+static struct symbol *__find_kernel_function(u64 addr, struct map **mapp)
+{
+	return machine__find_kernel_function(host_machine, addr, mapp, NULL);
+}
+
 static struct map *kernel_get_module_map(const char *module)
 {
 	struct rb_node *nd;
@@ -222,17 +229,29 @@ static int convert_to_perf_probe_point(struct probe_trace_point *tp,
 {
 	char buf[128];
 	int ret;
-
-	if (tp->symbol) {
+	struct symbol *sym;
+	struct map *map;
+	u64 addr;
+
+	if (!tp->symbol) {
+		sym = __find_kernel_function(tp->address, &map);
+		if (sym) {
+			pp->function = strdup(sym->name);
+			addr = map->unmap_ip(map, sym->start);
+			pp->offset = tp->address - addr;
+		} else {
+			ret = e_snprintf(buf, 128, "0x%" PRIx64,
+					 (u64)tp->address);
+			if (ret < 0)
+				return ret;
+			pp->function = strdup(buf);
+			pp->offset = 0;
+		}
+	} else {
 		pp->function = strdup(tp->symbol);
 		pp->offset = tp->offset;
-	} else {
-		ret = e_snprintf(buf, 128, "0x%" PRIx64, (u64)tp->address);
-		if (ret < 0)
-			return ret;
-		pp->function = strdup(buf);
-		pp->offset = 0;
 	}
+
 	if (pp->function == NULL)
 		return -ENOMEM;
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ