This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Propose to Use madvise API on Runtime Loader
- From: Rich Felker <dalias at libc dot org>
- To: lin zuojian <manjian2006 at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 23 May 2014 00:01:46 -0400
- Subject: Re: Propose to Use madvise API on Runtime Loader
- Authentication-results: sourceware.org; auth=none
- References: <20140523012855 dot GC14217 at ubuntu> <20140523025730 dot GL507 at brightrain dot aerifal dot cx> <20140523031242 dot GA24355 at ubuntu>
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