[uClibc] mmaps for malloc should be private

David McCullough davidm at snapgear.com
Mon Mar 22 00:44:13 UTC 2004


Jivin Alexandre Oliva lays it down ...
> On Mar 21, 2004, David McCullough <davidm at snapgear.com> wrote:
> 
> > Jivin Alexandre Oliva lays it down ...
> >> ... otherwise, if you happen to run a program linked with a uclibc for
> >> non-MMU on a system that does provide an MMU, and it issues a fork()
> >> system call, the memory will not be unshared.  Patch by David Howells
> >> <dhowells at redhat.com>.
> 
> > The only problem is,  uClinux doesn't implement private mappings,  so the
> > patch below will break all uClinux implementations using malloc :-)
> 
> Err...  Break in what sense?  The dynamic loader uses private mappings
> for _dl_malloc and they work just fine on uClinux.  Why wouldn't they
> work on for malloc() as well?

The dynamic loader doesn't run on uClinux (AFAIK ;-)  So that one isn't
going to cause any problems :-)

> Sure, in uClibc they're not private in the sense that nobody else can
> get to them, but the notion still applies, especially for MAP_ANON
> maps.
> 
> For file maps, I can suppose that this would break, but this is not
> the case we're talking about.

The basic problem is that on uClinux systems,  private mappings fail and
always have,  and for no other reason than working with the existing
kernels,  I think this one needs to stay as is.   But then I am not sure
what you are trying to achieve with NOMMU libs on MMU systems ;-)

Perhaps a config option,  if CONFIG_MMU is false,  ask if MAP_PRIVATE is
supported ?

Cheers,
Davidm

-- 
David McCullough, davidm at snapgear.com  Ph:+61 7 34352815 http://www.SnapGear.com
Custom Embedded Solutions + Security   Fx:+61 7 38913630 http://www.uCdot.org



More information about the uClibc mailing list