[PATCH][RFC] Allow explicit shrinking of arena heaps using an environment variable

Siddhesh Poyarekar siddhesh@redhat.com
Sat Jul 21 02:27:00 GMT 2012


On Fri, 20 Jul 2012 15:23:45 -0700 (PDT), Roland wrote:
> Like Carlos, I want to hear about the motivation for this.  I really
> don't like adding to the plethora of environment variables and other
> knobs affecting malloc.  We have too many of those as it is.

To be honest, the problem it solves for me is just the fact that it
shows up correctly in the maps and simulates the main process heap
more closely. I do understand that only this is a bad reason to add an
extra environment variable, which is why I had to look for a second,
more useful reason to do this, which is giving regular programs the
extra security that setuid programs get by dropping protection for
unused sections of the arena.

> The reason we're doing this in secure mode is clear to me.  If in
> practice the performance of the mmap is not significantly worse than
> the madvise on then I'd say we should do it unconditionally just to
> reduce the number of code paths regardless of all else.  Off hand
> that seems plausible.  Looking at recent Linux sources, I think the
> kernel will do the TLB shoot-down (which I think is the expensive
> thing) immediately on madvise.  So I think Siddhesh should do some
> empirical performance tests to compare the mmap and madvise paths
> and report back.

I'll do this.

Thanks,
Siddhesh



More information about the Libc-alpha mailing list