[musl] realloci(): A realloc() variant that works in-place

Florian Weimer fw@deneb.enyo.de
Sat Nov 1 14:18:04 GMT 2025


* Oliver Hunt:

>> On Oct 31, 2025, at 10:53 AM, Thiago Macieira <thiago@macieira.org> wrote:
>> 
>> On Friday, 31 October 2025 10:31:54 Pacific Daylight Time Paul Eggert wrote:
>>> On 10/31/25 11:25, Thiago Macieira wrote:
>>>> I think the Committee would balk at adding a function
>>>> that takes a pointer to already-freed memory whose purpose is to allow the
>>>> contents of the new object to be adjusted solely based on arithmetic.
>>> 
>>> Do you know of any platforms where this does not in fact work? Other
>>> than sanitizing platforms that go to some lengths to impose the
>>> Committee's rules even though the hardware would work fine?
>>> 
>>> If not, then perhaps we can convince the Committee that the mismatch
>>> between the current rules and reality is causing real harm, and that
>>> it'd be a win for C's users to change the standard to match reality better.
>> 
>> Oliver, please comment on ARM64e if you can, for pointer authentication. Think 
>> not just of statically-known pointers like vtables, but the general case of 
>> pointer authentication.
>
>
> I don’t believe ptrauth would really play into this, but MTE does.

I think MTE still works because if realloc changes the tag, the
pointer changes.  The application then has to do the offset-based
adjustment, which happens to change the tag only.

(I'm not saying this malloc change is a good idea.  I don't know of
its implications, and if it can be integrated safely with the other
parts of the languages.)


More information about the Libc-alpha mailing list