[PATCH] malloc: Count tcache entries downwards

Wilco Dijkstra Wilco.Dijkstra@arm.com
Wed May 7 12:42:09 GMT 2025


Hi Cupertino,

> I wonder if we do not have a race around mallopt already.
> First look at the do_set_... functions seem to change shared variables
> not really taking any consideration for concurrent accesses.

We do indeed. It's probably not a huge issue that there is no use of
atomics (only a few older targets will have issues), however none of the
code was designed with concurrent changes of the globals in mind.
So the same global can change when you read it multiple times,
and you have to somehow deal with that correctly...

Cheers,
Wilco


More information about the Libc-alpha mailing list