This is the mail archive of the
mailing list for the glibc project.
Re: why the DSO was loaded at address 0
- From: Florian Weimer <fweimer at redhat dot com>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: Abin Xu <abin1525 at gmail dot com>, libc-help at sourceware dot org
- Date: Tue, 21 May 2013 16:39:51 +0200
- Subject: Re: why the DSO was loaded at address 0
- References: <CAFcKLwhSEyMP4J-os+ZeZG0iEcq8t26=WvMpCEMVHkBJTi04pg at mail dot gmail dot com> <CALoOobO8f8JR51dDN7vDe79KoM55PF210oTuBwCNo=2Wxht07Q at mail dot gmail dot com>
On 05/21/2013 04:24 PM, Paul Pluzhnikov wrote:
On Tue, May 21, 2013 at 5:06 AM, Abin Xu <email@example.com> wrote:
But the file "error" shows that "/lib/libc.so.6" was loaded to address 0!
No, it does not.
14690: file=/lib/libc.so.6 ; needed by ./test 
14690: file=/lib/libc.so.6 ; generating link map
14690: dynamic: 0x0043cd7c base: 0x00000000 size: 0x00191988
14690: entry: 0x002c5e40 phdr: 0x002af034 phnum: 10
Presumably you are mis-interpreting base:0x00000000 is the load
address. It is not.
What it is is the relocation (difference) between linked-at address
and loaded-at address.
Usually, shared libraries are linked at address 0, and when they are,
the relocation is indeed the same as loaded-at address. But your
libc.so.6 has been prelinked to address 0x002af000, and was loaded at
that address, giving you 0 relocation.
By the way, do you know the correct way to obtain an address from
dladdr() which can be passed to addr2line? So far, I haven't managed to
do this when prelinking is involved.
Florian Weimer / Red Hat Product Security Team