-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
I can't find any implementation of locking or synchronization hooks for newlib.
I bumped into what I thought briefly was a SMP race in newlib malloc (it wasn't) and went looking to be sure that we were doing the locking correctly. And... we aren't?
I see that this was filed a year and a half ago (which is inexplicably an Enhancement and not a Bug): #21519 and was seemingly addressed by #21518 , which never merged.
The relevant hooks (e.g. __malloc_lock) are indeed compiled into our newlib libc.a binaries, but it looks like they also contain a weak fallback stub that just noops.
Am I wrong, or did we drop this? Without locking newlib's heap and stdio layers are fundamentally unsafe in any context that can be preempted, which is... mostly useless (especially when compared to our own heap and console layers that are threadsafe, SMP-aware and interrupt clean!).