This is the mail archive of the libc-alpha@sources.redhat.com 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: usage and breakage of dl-sbrk and dl-brk


> You miss the rest of dl-sysdep.  There is a call to sbrk() which is
> needed to deal with the case if ld.so is the program.  The sbrk()
> implementation uses brk() and so we end up with both, brk() and sbrk(),
> in ld.so.  The Hurd code is different and may not need sbrk.

Ah, yes.  I did miss that.  The notion that the page after ld.so's &_end
might be where sbrk is seems specific to Linux or at least Unix to me, and
so seems like it belongs in DL_SYSDEP_INIT instead of the generic file.
Not that this really matters since Hurd doesn't use generic/dl-sysdep.c,
but that would be consistent with the dl-brk/dl-sbrk modules being added
only for sysdeps/unix or sysdeps/unix/sysv/linux rather than in generic.

> > Since the malloc in dl-minimal.c only uses
> > mmap and never brk/sbrk, ld.so never uses the break at all.
> 
> You miss the case where the brk address is used by the normal brk of the
> application.

If you are referring to anything other than the partial page past ld.so's
_end, then I am still missing it now.

> > So, if there is any purpose to dl-brk/dl-sbrk at all, it's only because of
> > unix/sysv/linux/dl-sysdep.c and so those files ought to be linux-specific
> > rather than generic.
> 
> Well, we can do that.  No big problem.

Ok, please do (or I can do it if you prefer).


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