This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
PATCH: bug10812: relocate build-id vaddr
- From: Tony Jones <tonyj at suse dot de>
- To: systemtap at sourceware dot org
- Cc: fche at redhat dot com
- Date: Tue, 28 Sep 2010 14:28:52 -0700
- Subject: PATCH: bug10812: relocate build-id vaddr
This was discussed a while ago on IRC. Sorry for the delay in sending.
I tried running against the testsuite for both ppc64 and x86_64, no differences
(though I'm seeing a large# unexpected failures without the patch on our distro
which I need to look at -- so it's possible I'm lacking a lot of coverage).
This is basically ppc64 bug http://sourceware.org/bugzilla/show_bug.cgi?id=10812
Commit f4191849 made the build-id checking more robust so the following script
no longer faults:
probe module("libata").function("*").call {
printf ("%s\n", probefunc())
}
rather fails:
ERROR: Build-id mismatch: "libata" vs. "libata.ko" byte 0 (0xca vs 0x00) rc 0 -14
I tested the following patch with various versions of elfutils. There was some
discussion on IRC that the elfutils 138 hack would cause issues but I didn't see
a difference for the tests I ran. Also I wasn't able to trip the
'build_id_vaddr < base' check for the elfutils 141 case so there may be an
issue there.
Comments?
Tony
From: Tony Jones <tonyj@suse.de>
Subject: Relocate build_id_vaddr obtained from dwfl_module_build_id
Relocate the build_id_vaddr obtained from dwfl_module_build_id. Failure to
do this was causing ppc64 systems to fail the build-id check for cases such as:
probe module("libata").function("*").call {
printf ("%s\n", probefunc())
}
Signed-off-by: Tony Jones <tonyj@suse.de>
---
--- translate.cxx 2010-09-21 19:03:31.000000000 -0700
+++ translate.cxx.new 2010-09-14 23:40:47.000000000 -0700
@@ -4938,6 +4928,22 @@
build_id_vaddr += main_bias;
}
#endif
+
+ if (modname != "kernel") {
+ Dwarf_Addr reloc_vaddr = build_id_vaddr;
+ const char *secname;
+ int i;
+
+ i = dwfl_module_relocate_address (m, &reloc_vaddr);
+ dwfl_assert ("dwfl_module_relocate_address", i >= 0);
+
+ secname = dwfl_module_relocation_info (m, i, NULL);
+ dwfl_assert ("dwfl_module_relocation_info",
+ strcmp(secname, ".note.gnu.build-id") == 0);
+
+ build_id_vaddr = reloc_vaddr;
+ }
+
if (c->session.verbose > 1)
{
clog << "Found build-id in " << name