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: [PATCH][RFC] Allow explicit shrinking of arena heaps using anenvironment variable


On Sat, Jul 21, 2012 at 08:52:33AM +0530, Siddhesh Poyarekar wrote:
> On 21 July 2012 08:44, Rich Felker <dalias@aerifal.cx> wrote:
> >> Based on the madvise man page (and also comments earlier in the
> >> thread), MADV_DONTNEED also always[1] zeroes pages before subsequent
> >> accesses to it, so isn't the page protection the only additional
> >> action that the overlapping mmap provides? It shouldn't matter when
> >> the pages get zeroed, since from the real user perspective, they're
> >> zeroed pages.
> >
> > mprotect is not to prevent them from being accessed. It's to subtract
> > them from the commit charge. Clean PROT_NONE pages do not contribute
> > to commit charge. Writable pages do contribute to commit charge even
> > if they're clean.
> 
> I'm sorry, but I still don't understand how setuid programs would
> benefit from this, i.e. what is it about subtracting pages from the
> commit charge that appeases the setuid-ness of the programs?

It's discarding the pages (with madvise or mmap) that contributes (in
a perverse, unreliable way) to security. The mprotect has nothing to
do with security; it's just resource conservation that makes sense to
do at the same time.

Rich


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