This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: weird ro mapping generate by ld-linux.so


On Wed, Sep 15, 2010 at 14:33, Andreas Schwab <schwab@redhat.com> wrote:
>> now, if I look at the second RW PT_LOAD mapping described in the elf
>> file, its p_vaddr is 0x00000030cf483db8. Since the base address is
>> zero, I should find the corresponding data in memory at the same
>> address but the memory mappings generated by the dynamic loader is RO
>> at this address (the third mapping).
>
> That's the relro stuff, look for a GNU_RELRO program header.

So, you are saying that while a naive loader could map the entire RW
PT_LOAD mapping as RW, the gnu loader looks also at PT_GNU_RELRO to
minimize the amount of memory mapped as RW (I see that the end of
GNU_RELRO actually matches exactly a page boundary which is a nice
trick to allow the end of the PT_LOAD RW mapping to be RW). I wonder
why the linker does not simply generate 3 PT_LOAD entries (RO, RO, RW)
to do this instead of generating only two (RO,RW). Is this for
backward compatibility with tools that expect only two PT_LOAD entries
?

Mathieu
-- 
Mathieu Lacage <mathieu.lacage@gmail.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]