brk(2) trouble
Wolfram Gloger
Wolfram.Gloger@dent.med.uni-muenchen.de
Fri Nov 22 02:37:00 GMT 2002
> 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.
More information about the Libc-alpha
mailing list