Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <hwqnsamjwegmbizchfkfk3xqshaqsz6u2d6gcmfash6wyva3rf@gqzepxv4dr5l>
Date: Tue, 17 Jun 2025 01:54:09 +0200
From: Alejandro Colomar <alx@...nel.org>
To: Joseph Myers <josmyers@...hat.com>
Cc: Florian Weimer <fweimer@...hat.com>, 
	Adhemerval Zanella Netto <adhemerval.zanella@...aro.org>, musl@...ts.openwall.com, libc-alpha@...rceware.org, 
	наб <nabijaczleweli@...ijaczleweli.xyz>, Paul Eggert <eggert@...ucla.edu>, 
	Robert Seacord <rcseacord@...il.com>, Elliott Hughes <enh@...gle.com>, Bruno Haible <bruno@...sp.org>, 
	bug-gnulib@....org, JeanHeyd Meneide <phdofthehouse@...il.com>
Subject: Re: BUG: realloc(p,0) should be consistent with malloc(0)

Hi Joseph,

On Mon, Jun 16, 2025 at 11:39:48PM +0000, Joseph Myers wrote:
> On Mon, 16 Jun 2025, Alejandro Colomar wrote:
> 
> > Since glibc and Bionic are the two implementations that are currently
> > broken, could you please fix your implementations?  I'm sure the
> > C Committee will be much easier to convince if the implentations have
> > changed in a clear direction.
> > 
> > But if the committee says we're not fixing ISO C until the
> > implementations are fixed, and the implementations (you) refuse to
> > accept the fix until the committee standardizes something, then we'll
> > have the problem forever.
> 
> I think a better way to eliminate UB here would be to require this 
> erroneous case to terminate execution.  The sequence of changes to 
> semantics in past standard versions means that it's always a bad idea for 
> applications to try to use realloc with size 0 and preventing them more 
> strongly from doing so seems better to me than defining semantics that an 
> application might then be able to use in 10-15 years' time.

You'd be imposing a breakage of libc implementations that have never
been broken, such as musl, and probably also the BSDs.  I bet they'll
ignore the standard if it decides to irremediably break their
implementations without a reason.

You're allowed to break glibc beyond repair under the letter of the
standard, since UB allows you to terminate execution.  However, I don't
see you convincing musl and the BSDs to break what isn't broken.

The standard has been broken, and implementations written by the letter
of the standard have been equally broken.  However, most implementations
are sane; especially those that descend from UNIX V7.


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es/>

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.