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>] [day] [month] [year] [list]
Message-Id: <1472715654-18632-1-git-send-email-yao.jin@linux.intel.com>
Date:   Thu,  1 Sep 2016 15:40:54 +0800
From:   Jin Yao <yao.jin@...ux.intel.com>
To:     acme@...nel.org, jolsa@...nel.org
Cc:     Linux-kernel@...r.kernel.org, yao.jin@...ux.intel.com
Subject: [PATCH] perf symbols: Not using the ubuntu debuginfo when dso load

In dso__load, it iterates over *interesting" debug images which
have symtab/dynsym/opd section. For example, for loading the
libc-2.23.so on ubuntu 16.04, it will try 2 images in turn.

Try image 1: /lib/x86_64-linux-gnu/libc-2.23.so. Since it doesn't
have ".symtab" section, after symsrc__init return, runtime_ss = ss
(ss is associated with /lib/x86_64-linux-gnu/libc-2.23.so), and
syms_ss = NULL.

Try image 2: /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so.
Since it has ".symtab" section, after symsrc__init return,
syms_ss = ss (ss is associated with /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so),
and runtime_ss is not changed.

Now at the dso__load_sym(dso, map, syms_ss, runtime_ss, filter, kmod),
syms_ss is associated with /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so,
But the dso->name is /lib/x86_64-linux-gnu/libc-2.23.so.

In dso__load_sym, it needs to compute the dso->text_offset.

	if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
		dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;

The issue is that tshdr is the ELF section header for
/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so not the header for
/lib/x86_64-linux-gnu/libc-2.23.so. So the result of dso->text_offset
is not correct.

In symbol__disassemble, it calls map__rip_2objdump to convert symbol start
address to objdump address. The converted address is
rip + map->dso->text_offset

Since this text_offset is not correct, so finally objdump uses wrong
start address to disassemble /lib/x86_64-linux-gnu/libc-2.23.so.

This patch lets dso__load not try ubuntu debuginfo
(/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so in this example), because
1: the image doesn't have valid assembly code (check output of objdump)
2: it can avoid above issue.

Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
---
 tools/perf/util/symbol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 37e8d20..25a10a3 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1324,7 +1324,6 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
 	case DSO_BINARY_TYPE__DEBUGLINK:
 	case DSO_BINARY_TYPE__SYSTEM_PATH_DSO:
 	case DSO_BINARY_TYPE__FEDORA_DEBUGINFO:
-	case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO:
 	case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
 	case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
 		return !kmod && dso->kernel == DSO_TYPE_USER;
@@ -1353,6 +1352,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
 		return true;
 
 	case DSO_BINARY_TYPE__NOT_FOUND:
+	case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO:
 	default:
 		return false;
 	}
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ