Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2855736.2JlShyGXDD@tjmaciei-mobl5>
Date: Fri, 31 Oct 2025 12:17:30 -0700
From: Thiago Macieira <thiago@...ieira.org>
To: Andreas Schwab <schwab@...ux-m68k.org>
Cc: Alejandro Colomar <alx@...nel.org>, Paul Eggert <eggert@...ucla.edu>,
 libc-alpha@...rceware.org, musl@...ts.openwall.com,
 "A. Wilcox" <AWilcox@...cox-tech.com>,
 Lénárd Szolnoki <cpp@...ardszolnoki.com>,
 Collin Funk <collin.funk1@...il.com>,
 Arthur O'Dwyer <arthur.j.odwyer@...il.com>,
 Jonathan Wakely <jwakely@...hat.com>,
 "Paul E. McKenney" <paulmck@...nel.org>, Oliver Hunt <oliver@...le.com>
Subject: Re: Re: realloci(): A realloc() variant that works in-place

On Friday, 31 October 2025 11:35:10 Pacific Daylight Time Andreas Schwab wrote:
> > The temptation is too great to cast the old to a T* and dereference it,
> > which is UB because the memory has been freed, but will "happen to work"
> > for sufficiently many executions that it might go unnoticed. Then there's
> > the issue that the relocated T *object is itself in an inconsistent state
> > and one must avoid calling most functions on it.
> 
> And it will not be thread safe.  The freed memory can be allocated to
> another thread any time.

No argument there. It's already UB. What I meant is that it will "happen to 
work" under quite a lot of software testing for the problem to go unnoticed, 
and then present itself as a heisenbug to the downstream user.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Download attachment "signature.asc" of type "application/pgp-signature" (871 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.