MDEV-31871: maria-install-db fails on MacOS
Follow-up to fix issue with access to probably not-initialized mutex/cond_var Constructor of the class st_debug_sync_globals was changed to initialize the data members dsp_hits, dsp_executed, dsp_max_active with zero. Formerly, these data members were filled with zeroes by C-runtime since the variable debug_sync_global was declared as static and according with C rules the static variable initialized with zero bytes. By the same reason, the data members debug_sync_global->ds_mutex debug_sync_global->ds_cond were initialized by zeros before the patch for MDEV-31871. After this patch the memory for the synch primitives debug_sync_global->ds_mutex and debug_sync_global->ds_cond are initialized explicitly by calling the functions mysql_mutex_init/mysql_cond_init so access to these synch primitives should be done only after such initialization be completed. Guarded access to these synch primitives has been added to the function debug_sync_end_thread() that is called on clean up since that was single problem place detected by MSAN. Theoretically problem places located in the function debug_sync_execute were not protected with similar check since it is not obvious that the variables debug_sync_global->ds_mutex and debug_sync_global->ds_cond could be not initilialized for use cases where the function debug_sync_execute() is called. It is required additional study to conclude whether it does need or not.
Showing
Please register or sign in to comment