This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: brk(2) trouble
- From: Wolfram Gloger <Wolfram dot Gloger at dent dot med dot uni-muenchen dot de>
- To: roland at redhat dot com
- Cc: velco at fadata dot bg, libc-alpha at sources dot redhat dot com
- Date: Fri, 22 Nov 2002 10:44:46 +0100 ("MET)
- Subject: Re: brk(2) trouble
- References: <200211220151.gAM1p4x26932@magilla.sf.frob.com>
> The Linux versions do not enforce a __minbrk value, so getting that
> initialized is not an issue. I think a brk(&_start) will just happily eat
> your text and data mappings in Linux.
Not quite -- Linux sys_brk(brk) first checks against brk<end_code,
where end_code is set up by the ELF loader in the kernel, as the
highest address (+1) which lies in an executable section of the ELF
file (not the interpreter). So you could actually trash your data
segment by shrinking brk, but not the text mapping(s).
Couldn't you just let the kernel deal with __minbrk restrictions on
NetBSD, too?
Regards,
Wolfram.