This is the mail archive of the libc-hacker@sourceware.cygnus.com 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]

Re: dl-load.c suggestion


> That is not going to work in general.  For instance, from my /bin/ls:

Please understand that I am not talking about anything new in this regard.
The issue is not whether there will be a contiguous accessible region in
the final address space.  The point is that the load address of the object
as a whole can be arbitrary, but all the segments must be at constant
distances from the other segments.  Therefore, once the first segment is
loaded at an arbitrary address chosen by mmap, all the other segments must
be loaded at fixed addressed relative to that address.

The only straightforward way to make sure enough address space will be
available to place the later segments relative to the first one is to have
the mmap call for the first segment request the amount of space required to
span from the beginning of the first segment to the end of the last segment.
This is what it already does and has for a long time (see dl-load.c:695).

Yes, the tlb flush is the same; I did not say differently.  It is more
efficient in the operating system to do mprotect than mmap, because it
doesn't have to consult the file table or the filesystem layer again, or
tweak the memory backing object data structures, just the page tables.


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