From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Removing sbrk and brk
Date: Thu, 2 Jan 2014 17:03:02 -0500 [thread overview]
Message-ID: <20140102220302.GR24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <20131223044609.GZ24286@brightrain.aerifal.cx>
On Sun, Dec 22, 2013 at 11:46:09PM -0500, Rich Felker wrote:
> > so the options in increasing effort are
> >
> > 1) leave it as is
> > 2) completely remove sbrk/brk
> > 3) always fail (except for sbrk(0))
> > 4) emulate with mmap+mprotect
> > 5) malloc without brk
> >
> > i like 1) or 3) for 1.0 and 5) for post-1.0
>
> I agree mostly. Option 5 would be ideal, but it depends on determining
> whether there would be detrimental affects on performance. Even if
> there are, however, it may be acceptable since I eventually want to
> drop the madvise-based approach to returning memory to the kernel,
> which doesn't relinquish any commit charge, and replace it with
> PROT_NONE...
>
> For now though it seems we're trying to decide between options 1 and
> 3. If we go for option 1, we should fix the integer overflow/wrapping
> issue in sbrk you reported on irc..
OK, I'm modifying sbrk so sbrk(0) returns the current brk and
sbrk(nonzero) returns (void*)-1 with errno set to ENOMEM (option 3
above). This should help us catch any programs attempting to use sbrk
for memory management and get them fixed rather than dealing with
hideous memory-corruption errors that are hard to track down, and
we'll have some time to track them down between now and 1.0.
sbrk may be re-added sometime after 1.0 if malloc is changed to no
longer use the brk (option 5 above).
Rich
next prev parent reply other threads:[~2014-01-02 22:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-21 23:40 Rich Felker
2013-12-22 2:15 ` Luca Barbato
2013-12-22 17:58 ` Richard Pennington
2013-12-22 18:21 ` Luca Barbato
2013-12-22 18:48 ` Szabolcs Nagy
2013-12-22 21:55 ` Christian Neukirchen
2013-12-23 4:46 ` Rich Felker
2014-01-02 22:03 ` Rich Felker [this message]
2014-01-03 11:51 ` Thorsten Glaser
2014-01-03 12:59 ` Daniel Cegiełka
2014-01-03 17:33 ` Rich Felker
2014-01-03 18:19 ` Rich Felker
2014-01-03 19:03 ` Rich Felker
2014-01-06 14:51 ` Thorsten Glaser
2014-01-06 22:40 ` Rich Felker
2014-01-07 9:43 ` Thorsten Glaser
2014-01-07 16:06 ` Rich Felker
2014-01-07 22:00 ` Rich Felker
2014-02-21 16:03 ` Daniel Cegiełka
2014-02-21 16:36 ` Szabolcs Nagy
2014-02-21 16:47 ` Daniel Cegiełka
2014-02-21 17:09 ` Rich Felker
2014-02-21 22:34 ` Daniel Cegiełka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140102220302.GR24286@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).