Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 25 May 2023 11:38:06 +0200
From: Jₑₙₛ Gustedt <>
To: Rich Felker <>
Subject: Re: [C23 new stdlib 1/4] C23: add the new interfaces
 free_sized and free_aligned_sized for stdlib.h

on Wed, 24 May 2023 17:31:34 -0400 you (Rich Felker <>)

> These really should be in a separate file or files calling free() not
> __libc_free, since if free has been replaced, they should call that,
> not the libc-internal one. (Imagine a program linked or LD_PRELOADed
> with an alternate malloc implementation that's not C23-aware.)


> Optionally, they could also evaluate the predicate to determine if
> malloc has been replaced, and if not, do the actual check. The
> alignment check is trivial and malloc-agnostic. The size check would
> require adding a libc-internal way to access malloc_usable_size. But
> this can all be done later if desired.

I don't think these interfaces are about checking consistency. They
don't provide any reasonable means to return an error. In the contrary
they are meant to provide more efficient implementations for the
feature if the correct size is used. Otherwise, the behavior is just

The first question to be would be if we want to offer that
functionality for musl's allocator. (I don't feel that I know enough
to do that.) The second question is, do we want to allow alternate
malloc implementations to provide replacements for this? Then we
should perhaps have these new interfaces as weak symbols?


:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: ::

Content of type "application/pgp-signature" skipped

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.