drreg_init's realloc of accumulated slots across multiple calls assumes single-threaded use and breaks prior use during process init
drreg_init takes the num_spill_slots requested by each caller and accumulates them. It re-allocates to add the new request, without any synchronization. It implicitly assumes it's single-threaded for all of these calls: basically that it's during process init. This should be explicitly documented and checked for.
There is a further restriction stemming from this realloc: drreg operations that use spill slots can't be used until all components have called drreg_init, because the slot numbers may change. This could be problematic for clients/extensions who want to use drreg for some static code tweaking during process init. I don't think we have any existing code like that in the DR repo, but Dr. Memory does this (WIP drreg branch https://github.com/DynamoRIO/drmemory/tree/i1795-use-drreg). It has out-of-line call code generated at init time, with an array of them for each of different registers to restore. In fact, I enabled use during process init for DrM for #2910 (closed). We'll need to reconcile this somehow.