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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat,  7 Jan 2017 14:25:09 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Masami Hiramatsu <mhiramat@...nel.org>,
        linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>
Subject: [PATCH perf/core 1/4] perf-probe: Fix to show correct locations for events on modules

Fix to show correct locations for events on modules by
relocating given address. Currently the relocation is
done when we failed to find the address in debuginfo,
but for modules it always makes a mistakes.

E.g. without this fix, events on module seems wrong,
but other cases (kernel and user space) looks good.

  # perf probe -l
    probe:SyS_remap_file_pages (on SyS_remap_file_pages@...mmap.c)
    probe:chv_prepare_pll (on intel_plane_atomic_get_property+16@.../i915/intel_atomic_plane.c in i915)
    probe_perf:alias_lookup (on alias_lookup@...l/alias.c in /home/mhiramat/ksrc/linux/tools/perf/perf)

With this fix, all cases are OK now.

  # perf probe -l
    probe:SyS_remap_file_pages (on SyS_remap_file_pages@...mmap.c)
    probe:chv_prepare_pll (on chv_prepare_pll@.../drm/i915/intel_display.c in i915)
    probe_perf:alias_lookup (on alias_lookup@...l/alias.c in /home/mhiramat/ksrc/linux/tools/perf/perf)

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

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index df4debe..0278fe1 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1543,16 +1543,12 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,
 	Dwarf_Addr _addr = 0, baseaddr = 0;
 	const char *fname = NULL, *func = NULL, *basefunc = NULL, *tmp;
 	int baseline = 0, lineno = 0, ret = 0;
-	bool reloc = false;
 
-retry:
+	/* We always need to relocate the address for aranges */
+	if (debuginfo__get_text_offset(dbg, &baseaddr) == 0)
+		addr += baseaddr;
 	/* Find cu die */
 	if (!dwarf_addrdie(dbg->dbg, (Dwarf_Addr)addr, &cudie)) {
-		if (!reloc && debuginfo__get_text_offset(dbg, &baseaddr) == 0) {
-			addr += baseaddr;
-			reloc = true;
-			goto retry;
-		}
 		pr_warning("Failed to find debug information for address %lx\n",
 			   addr);
 		ret = -EINVAL;

Powered by blists - more mailing lists