From: Luis Machado <luisgpm@linux.vnet.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Handle absence of DT_DEBUG while debugging ld.so
Date: Tue, 29 Jul 2008 02:57:00 -0000 [thread overview]
Message-ID: <1217300235.16935.35.camel@gargoyle> (raw)
In-Reply-To: <20080729022723.GA6298@caradoc.them.org>
On Mon, 2008-07-28 at 22:27 -0400, Daniel Jacobowitz wrote:
> On Mon, Jul 28, 2008 at 08:54:37PM -0300, Luis Machado wrote:
> > Hi folks,
> >
> > When trying to debug ld.so, we may find that the DT_DEBUG entry in
> > the .dynamic section is missing, thus GDB tries to look for the _r_debug
> > minimal symbol, and eventually finds it. This works OK as long as the
> > _r_debug minimal symbol is correct and initialized.
> >
> > In the case where GDB fetches an uninitialized _r_debug minimal symbol
> > and tries to access its address, we have a memory access error, just
> > like below:
> >
> > (gdb) r
> > Starting program: /foo/lib/ld.so.1
> > Cannot access memory at address 0x2f648
> >
> > Thus, we should guard this piece of code against uninitialized addresses
> > so that GDB can skip this entry and look for another (hopefully) valid
> > _r_debug symbol.
>
> I think this is a PIE-related problem. It has nothing to do with
> uninitialized, because we're just taking the symbol's
> address; but the address you've got there looks wrong. It's as if
> ld.so was loaded at 0x0. How did that happen?
Yes, this specific address seems broken somehow. This is the first
_r_debug entry GDB gets:
$6 = {ginfo = {name = 0x10a10b70 "_r_debug", value = {ivalue = 194116,
block = 0x2f644, bytes = 0x2f644 <Address 0x2f644 out of bounds>,
address = 194116, chain = 0x2f644}, language_specific =
{cplus_specific = {demangled_name = 0x0}}, language = language_auto,
section = 20, bfd_section = 0x109ea688}, info = 0x0, size = 20,
filename = 0x10a09fe0 "rawmemchr.c", type = mst_bss, hash_next = 0x0,
demangled_hash_next = 0x0}
And this is the next _r_debug minimal symbol entry GDB gets:
$7 = {ginfo = {name = 0x10a10b70 "_r_debug", value = {ivalue =
134411844, block = 0x802f644,
bytes = 0x802f644 <Address 0x802f644 out of bounds>, address =
134411844, chain = 0x802f644}, language_specific = {cplus_specific = {
demangled_name = 0x0}}, language = language_auto, section = 20,
bfd_section = 0x109ea688}, info = 0x0, size = 20,
filename = 0x10a09fe0 "rawmemchr.c", type = mst_bss, hash_next = 0x0,
demangled_hash_next = 0x0}
Now, i see the very same offset there, but now looks like it has been
shifted to a different address (ld's load address probably).
So, that's why i was imagining it wasn't really initialized yet.
Regards,
Luis
next prev parent reply other threads:[~2008-07-29 2:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 23:55 Luis Machado
2008-07-29 2:27 ` Daniel Jacobowitz
2008-07-29 2:57 ` Luis Machado [this message]
2008-07-29 3:03 ` Luis Machado
2008-07-29 12:13 ` Daniel Jacobowitz
2008-07-29 12:46 ` Luis Machado
2008-08-12 18:16 ` Luis Machado
2008-09-05 18:31 ` Luis Machado
2008-07-29 12:55 ` Pedro Alves
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=1217300235.16935.35.camel@gargoyle \
--to=luisgpm@linux.vnet.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/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