From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Possible infinite loop in qsort()
Date: Thu, 14 Jan 2016 17:17:11 -0500 [thread overview]
Message-ID: <20160114221711.GT238@brightrain.aerifal.cx> (raw)
In-Reply-To: <5694F0D5.8080709@openwall.com>
On Tue, Jan 12, 2016 at 03:25:57PM +0300, Alexander Cherepanov wrote:
> On 2016-01-10 14:38, Markus Wichmann wrote:
> >On Sat, Jan 09, 2016 at 11:05:16PM -0500, Rich Felker wrote:
> >>On Sat, Jan 09, 2016 at 10:07:19AM +0100, Felix Janda wrote:
> >>>musl enforces that object sizes should not be greater than PTRDIFF_MAX.
> >>>See for example the discussion at
> >>>
> >>>http://www.openwall.com/lists/musl/2013/06/27/7
> >>>
> >>>So there will not be objects of size 3GB with musl on x32. Since the
> >>>Leonardo numbers grow slower than 2^n in general no overflow should
> >>>happen if "size" is valid. Otherwise, UB was invoked.
> >>
> >
> >OK. Might want to make that assumption a bit more prominent, because
> >this is the first time I've ever heard about it, but OK, no objects >2GB
> >on 32-bit archs.
>
> Yeah, I don't see it in the doc. Did I miss it?
The documentation is incomplete; in particular, the part that would
cover things like this has not been written at all and exists just in
my head (and to a lesser extent as implied from commit messages and
mailing list threads). :-)
> If it neither works nor documented as a limit I'd call it a bug.
An implementation is under no obligation to document the conditions
under which it's "out of memory" (ENOMEM). These are usually complex
and highly implementation specific.
> BTW the support in compilers for working with objects larger than
> half the address space is buggy -- see
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67999 . The same
> situation -- it neither works nor documented. Somewhat puzzling...
The only bug here is that it's not documented. "Supporting" such
objects without making ptrdiff_t a 64-bit type is an intolerably bad
QoI issue.
Rich
next prev parent reply other threads:[~2016-01-14 22:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-09 8:21 Markus Wichmann
2016-01-09 9:07 ` Felix Janda
2016-01-10 4:05 ` Rich Felker
2016-01-10 10:33 ` Szabolcs Nagy
2016-01-10 11:38 ` Alexander Monakov
2016-01-10 11:38 ` Markus Wichmann
2016-01-10 12:15 ` Szabolcs Nagy
2016-01-12 12:25 ` Alexander Cherepanov
2016-01-12 12:48 ` Szabolcs Nagy
2016-01-12 14:31 ` Alexander Cherepanov
2016-01-12 16:22 ` Szabolcs Nagy
2016-01-14 22:21 ` Rich Felker
2016-01-14 22:17 ` Rich Felker [this message]
2016-01-10 16:35 ` Morten Welinder
2016-01-10 16:45 ` Jens Gustedt
2016-01-12 10:30 ` Alexander Cherepanov
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=20160114221711.GT238@brightrain.aerifal.cx \
--to=dalias@libc.org \
--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).