Hi Aaron, On Wed, 2026-09-30 at 15:05 -0400, Aaron Merey wrote: > Remove the rdlock held throughout elf_getscn and replace it with a wrlock > that covers only the one-time initialization of section zero. This > reduces rwlock overhead when on the hotpath and also fixes a race > condition where a flag (runp->cnt) could be updated while the rdlock was > being held, causing leaks and racing stores. > > Atomic store/acquire is now used when accessing section zero outside > of when a lock is being held. > > VALGRIND_HG_DISABLE_CHECKING is used on runp->cnt before its > atomic_store_release call to prevent helgrind false positives since > there is no definite order to whether lock-free loads of runp->cnt happen > before or after this store. > > Signed-off-by: Aaron Merey <[email protected]> > > --- > v2: move elf32_offscn.c changes into separate commit, add valgrind annotation
This looks good. v2 addresses all my questions I had about v1. Moving the elf32_offscn.c changes into their own commit makes this patch easier to reason about. If helgrind cannot check the accesses to/from cnt maybe put the VALGRIND_HG_DISABLE_CHECKING in elf_begin where the scns state are created? Or is that too tricky? It might be fine here on "first access". Thanks, Mark
