From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: holywar: malloc() vs. OOM
Date: Sun, 24 Jul 2011 15:29:14 +0200 [thread overview]
Message-ID: <20110724132913.GH27634@port70.net> (raw)
In-Reply-To: <20110724124034.GI132@brightrain.aerifal.cx>
* Rich Felker <dalias@aerifal.cx> [2011-07-24 08:40:34 -0400]:
> On Sun, Jul 24, 2011 at 02:33:25PM +0400, Vasiliy Kulikov wrote:
> > But looking at the problem from the pragmatic point of view we'll see
> > that libc is actually the easiest place where the problem may be
> > workarounded (not fixed, surely). The workaround would be simply
> > raising SIGKILL if malloc() fails (either because of brk() or mmap()).
> > For the rare programs craving to handle OOM such code should be used:
>
> This is absolutely wrong and non-conformant. It will also ruin all
> A better solution might be to have a gcc option to generate a read
> from the base address the first time a function performs arithmetic on
> a pointer it has not already checked. This is valid because the C
sounds reasonable
> > Probably I overestimate the importance of OOM errors, and (1) in
> > particular. However, I think it is worth discussing.
>
> I don't think you overestimate the importance of OOM errors. Actually
> Linux desktop is full of OOM errors that ruin usability, like file
> managers that hang the system for 5 minutes then crash if you navigate
> to a directory with a 15000x15000 image file. Unfortunately I don't
> think it's possible to fix at the libc level, and fixing the worst
> issues (DoS from apps crashing when they should not crash) usually
> involves both sanity-checking the size prior to calling malloc *and*
> checking the return value of malloc...
what about providing an alternative libc or libcwrapper api
it could "fix" deprecated/dangerous calls
(maybe turn them into compiletime errors)
and things like oom failures into runtime errors
so bad code can be compiled against this radical extremist libc
i guess for now running code under valgrind can catch most
of these issues..
next prev parent reply other threads:[~2011-07-24 13:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-24 10:33 Vasiliy Kulikov
2011-07-24 12:40 ` Rich Felker
2011-07-24 13:29 ` Szabolcs Nagy [this message]
2011-07-24 13:27 ` Rich Felker
2011-07-24 18:33 ` Vasiliy Kulikov
2011-07-24 22:24 ` Rich Felker
2011-07-24 18:25 ` Vasiliy Kulikov
2011-07-24 22:19 ` Rich Felker
2011-07-25 17:43 ` Vasiliy Kulikov
2011-07-25 19:21 ` Rich Felker
2011-07-24 12:44 ` Szabolcs Nagy
2011-07-24 12:53 ` Szabolcs Nagy
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=20110724132913.GH27634@port70.net \
--to=nsz@port70.net \
--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).