[PATCH] Use size_t for mallinfo fields.

Szabolcs Nagy szabolcs.nagy@arm.com
Thu Jul 23 14:38:36 GMT 2020


The 07/08/2020 09:24, Martin Liška wrote:
> Subject: [PATCH] Add mallinfo2 function that support sizes >= 4GB.
> 
> The current int type can easily overflow for allocation of more
> than 4GB.

i don't think a new symbol with a similar bad
design as the old one is desirable.

(i think a good design would allow exposing malloc
internal info without abi and api issues when the
internals change, e.g. no struct field names and
struct layout that are tied to internals. and
supportable by other implementations so whatever
gcc is doing would work elsewhere not just on glibc)

one hack that may be acceptable is to use some
nonsensical value in a mallinfo field to signal that
the fields have new meaning, then the api can work
backward compatibly when all field values are less
than 2G and after that things are broken anyway so
we can switch to some different struct content that
has no overflow issue, but abi compatible with the
old struct (e.g. round up the values to multiples of
1M), so we don't need a new abi symbol and interposers
continue to work. (but i'm not entirely sure this
is a good idea either)


More information about the Libc-alpha mailing list