Skip to content

rts: add missing ccs_mutex guard to internal_dlopen

Cheng Shao requested to merge type-dance/ghc:addDLL-ccs-mutex into master

When dlopen() loads a profiled dynamic library, it calls the ctors which will call registerCcsList() to append the defined CostCentreStacks to CCS_LIST. This execution path starting from addDLL() was only protected by dl_mutex previously. However, another thread may be doing other things with the RTS linker that transitively calls refreshProfilingCCSs() which also accesses CCS_LIST, and those execution paths are protected by linker_mutex. So there's a risk of data race that may lead to segfaults, and we need to ensure the ctors are also protected by ccs_mutex, hence this MR. Closes #24423 (closed).

Merge request reports