From: Mark Wielaard <mjw@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: "Frank Ch. Eigler" <fche@elastic.org>, systemtap@sources.redhat.com
Subject: Re: rfc patch for buildid < shlib base address
Date: Mon, 16 Mar 2009 17:28:00 -0000 [thread overview]
Message-ID: <1237210221.2543.4.camel@fedora.wildebeest.org> (raw)
In-Reply-To: <1237157682.15044.7.camel@hermans.wildebeest.org>
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
On Sun, 2009-03-15 at 23:54 +0100, Mark Wielaard wrote:
> And digging deeper I see roland already fixed this issue a couple of
> days ago: https://bugzilla.redhat.com/show_bug.cgi?id=489439
>
> I'll look into adding the workaround described in that bug to our code
> tomorrow.
Added as:
commit 1bb61ae1fd02086560f5cd019db320b5a217ba05
Author: Mark Wielaard <mjw@redhat.com>
Date: Mon Mar 16 14:19:20 2009 +0100
Add workaround for dwfl_module_build_id bug with elfutils < 0.140.
* translate.cxx (dump_unwindsyms): Check elfutils version and whether
build_id_vaddr < base, and if so add main_bias to address.
Note that it checks both for !_ELFUTILS_PREREQ(0,141) and for
build_id_vaddr < base because it looks like the buggy behavior doesn't
occur always with older elfutils versions and if it doesn't occur, then
adding main.bias is wrong. I assume that if the bug occurs then
build_id_vaddr will always be smaller than main.bias since it is
supposed to go as close as possible to the start of the elf file.
Cheers,
Mark
[-- Attachment #2: translate-build_id.patch --]
[-- Type: text/x-patch, Size: 1608 bytes --]
diff --git a/translate.cxx b/translate.cxx
index 17c37dc..f4c2853 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4497,17 +4497,35 @@ dump_unwindsyms (Dwfl_Module *m,
// see https://bugzilla.redhat.com/show_bug.cgi?id=465872
// and http://sourceware.org/ml/systemtap/2008-q4/msg00579.html
#ifdef _ELFUTILS_PREREQ
-#if _ELFUTILS_PREREQ(0,138)
+ #if _ELFUTILS_PREREQ(0,138)
// Let's standardize to the buggy "end of build-id bits" behavior.
build_id_vaddr += build_id_len;
+ #endif
+ #if !_ELFUTILS_PREREQ(0,141)
+ #define NEED_ELFUTILS_BUILDID_WORKAROUND
+ #endif
+#else
+ #define NEED_ELFUTILS_BUILDID_WORKAROUND
#endif
+
+ // And check for another workaround needed.
+ // see https://bugzilla.redhat.com/show_bug.cgi?id=489439
+ // and http://sourceware.org/ml/systemtap/2009-q1/msg00513.html
+#ifdef NEED_ELFUTILS_BUILDID_WORKAROUND
+ if (build_id_vaddr < base && dwfl_module_relocations (m) == 1)
+ {
+ GElf_Addr main_bias;
+ dwfl_module_getelf (m, &main_bias);
+ build_id_vaddr += main_bias;
+ }
#endif
- if (c->session.verbose > 1) {
- clog << "Found build-id in " << name
- << ", length " << build_id_len;
- clog << ", end at 0x" << hex << build_id_vaddr
- << dec << endl;
- }
+ if (c->session.verbose > 1)
+ {
+ clog << "Found build-id in " << name
+ << ", length " << build_id_len;
+ clog << ", end at 0x" << hex << build_id_vaddr
+ << dec << endl;
+ }
}
// Look up the relocation basis for symbols
prev parent reply other threads:[~2009-03-16 13:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 2:16 Frank Ch. Eigler
2009-02-25 2:38 ` Roland McGrath
2009-02-25 2:53 ` Frank Ch. Eigler
2009-02-25 3:02 ` Roland McGrath
2009-02-25 22:15 ` Mark Wielaard
2009-03-16 5:20 ` Mark Wielaard
2009-03-16 6:16 ` Mark Wielaard
2009-03-16 6:32 ` Mark Wielaard
2009-03-16 17:28 ` Mark Wielaard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1237210221.2543.4.camel@fedora.wildebeest.org \
--to=mjw@redhat.com \
--cc=fche@elastic.org \
--cc=roland@redhat.com \
--cc=systemtap@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).