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: <20200221024608.1847-2-yao.jin@linux.intel.com>
Date:   Fri, 21 Feb 2020 10:46:07 +0800
From:   Jin Yao <yao.jin@...ux.intel.com>
To:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com
Cc:     Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com,
        Jin Yao <yao.jin@...ux.intel.com>
Subject: [PATCH v2 1/2] perf util: Print al_addr when symbol is not found

For branch mode, if the symbol is not found, it prints
the address.

For example, 0x0000555eee0365a0 in below output.

Overhead  Command  Source Shared Object  Source Symbol                            Target Symbol
  17.55%  div      libc-2.27.so          [.] __random                             [.] __random
   6.11%  div      div                   [.] 0x0000555eee0365a0                   [.] rand
   6.10%  div      libc-2.27.so          [.] rand                                 [.] 0x0000555eee036769
   5.80%  div      libc-2.27.so          [.] __random_r                           [.] __random
   5.72%  div      libc-2.27.so          [.] __random                             [.] __random_r
   5.62%  div      libc-2.27.so          [.] __random_r                           [.] __random_r
   5.38%  div      libc-2.27.so          [.] __random                             [.] rand
   4.56%  div      libc-2.27.so          [.] __random                             [.] __random
   4.49%  div      div                   [.] 0x0000555eee036779                   [.] 0x0000555eee0365ff
   4.25%  div      div                   [.] 0x0000555eee0365fa                   [.] 0x0000555eee036760

But it's not very easy to understand what the instructions
are in the binary. So this patch uses the al_addr instead.

With this patch, the output is

Overhead  Command  Source Shared Object  Source Symbol                            Target Symbol
  17.55%  div      libc-2.27.so          [.] __random                             [.] __random
   6.11%  div      div                   [.] 0x00000000000005a0                   [.] rand
   6.10%  div      libc-2.27.so          [.] rand                                 [.] 0x0000000000000769
   5.80%  div      libc-2.27.so          [.] __random_r                           [.] __random
   5.72%  div      libc-2.27.so          [.] __random                             [.] __random_r
   5.62%  div      libc-2.27.so          [.] __random_r                           [.] __random_r
   5.38%  div      libc-2.27.so          [.] __random                             [.] rand
   4.56%  div      libc-2.27.so          [.] __random                             [.] __random
   4.49%  div      div                   [.] 0x0000000000000779                   [.] 0x00000000000005ff
   4.25%  div      div                   [.] 0x00000000000005fa                   [.] 0x0000000000000760

Now we can use objdump to dump the object starting from 0x5a0.

For example,
objdump -d --start-address 0x5a0 div

00000000000005a0 <rand@plt>:
 5a0:   ff 25 2a 0a 20 00       jmpq   *0x200a2a(%rip)        # 200fd0 <__cxa_finalize@...+0x200a20>
 5a6:   68 02 00 00 00          pushq  $0x2
 5ab:   e9 c0 ff ff ff          jmpq   570 <srand@...-0x10>
 ...

 v2:
 ---
 No change

Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
---
 tools/perf/util/sort.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index ab0cfd790ad0..e860595576c2 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -869,7 +869,8 @@ static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf,
 	if (he->branch_info) {
 		struct addr_map_symbol *from = &he->branch_info->from;
 
-		return _hist_entry__sym_snprintf(&from->ms, from->addr, he->level, bf, size, width);
+		return _hist_entry__sym_snprintf(&from->ms, from->al_addr,
+						 he->level, bf, size, width);
 	}
 
 	return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
@@ -881,7 +882,8 @@ static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf,
 	if (he->branch_info) {
 		struct addr_map_symbol *to = &he->branch_info->to;
 
-		return _hist_entry__sym_snprintf(&to->ms, to->addr, he->level, bf, size, width);
+		return _hist_entry__sym_snprintf(&to->ms, to->al_addr,
+						 he->level, bf, size, width);
 	}
 
 	return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ