Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180412132629.GQ3094@brightrain.aerifal.cx>
Date: Thu, 12 Apr 2018 09:26:29 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [RFC PATCH] reduce severity of ldso reclaim_gaps hack

On Thu, Apr 12, 2018 at 09:40:23AM +0300, Alexander Monakov wrote:
> On Thu, 12 Apr 2018, Rich Felker wrote:
> > > > This does not seem necessary. Free chunks in the last bin can be
> > > > larger than MMAP_THRESHOLD; they're just broken up to satisfy
> > > > allocations. Of course it's unlikely to happen anyway.
> > > 
> > > Do such oversized chunks appear in normal operation? This seems non-obvious,
> > > so a comment pointing that out would probably be helpful.
> > 
> > The only way I could see it happening is on an arch ABI that allows
> > very large pages (and has the ELF load segments aligned accordingly,
> > as x86_64 does). In this case if the kernel/hardware only supported
> > large (e.g. 2MB) pages, you'd pretty much always end up with >1.5MB of
> > reclaimed space per DSO. IMO this is an awful kernel/hardware
> > constraint to have, very wasteful, but it's exactly the situation
> > where you'd most care about the gaps getting reclaimed for something
> > useful.
> 
> What I meant to ask is: apart from chunks created via reclaim_gaps, can
> such oversized chunks appear as a result of malloc-family calls invoked
> by the program?

Yes, simple:

void *p[1000];
for (i=0; i<1000; i++) p[i]=malloc(1000);
for (i=0; i<1000; i++) free(p[i]);

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.