This is the mail archive of the libc-alpha@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: Propose to Use madvise API on Runtime Loader


On Fri, May 23, 2014 at 11:12:42AM +0800, lin zuojian wrote:
> Hi Rich,
> On Thu, May 22, 2014 at 10:57:30PM -0400, Rich Felker wrote:
> > As written this code is definitely not appropriate; it could even end
> > up applying MADV_DONTNEED to writable memory, which does not just
> > affect caching but actually obliterates any changes made to it (e.g.
> > relocations) and restores the mapping to the original on-disk state.
> > 
>     I think you have not read my code carefully. My code means I want to
>     drop the pages & page tables from elf header to .rel.dyn, which is a
>     readonly region. My point is to drop these pages which is readonly
>     and clean and will not need after relocation.

Your code as written drops from the beginning of the map up to a
length based on the position and number of reloctions, which is utter
nonsense. But even if that were fixed, it would be incorrect because
madvise has page granularity.

Rich


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