1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-24317 Data race in LOGGER::init_error_log at sql/log.cc:1443 and in LOGGER::error_log_print at sql/log.cc:1181

don't initialize error_log_handler_list in set_handlers()
* error_log_handler_list is initialized to LOG_FILE early, in init_base()
* set_handlers always reinitializes it to LOG_FILE, so it's pointless
* after init_base() concurrent threads start using sql_log_warning,
  so following set_handlers() shouldn't modify error_log_handler_list
  without some protection
This commit is contained in:
Sergei Golubchik
2022-04-12 13:07:20 +02:00
parent 6891c4874a
commit bbdec04d59
4 changed files with 8 additions and 17 deletions

View File

@ -3607,7 +3607,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
sql_print_information("Got signal %d to shutdown mysqld",sig);
#endif
/* switch to the old log message processing */
logger.set_handlers(LOG_FILE, global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE,
logger.set_handlers(global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE,
opt_log ? LOG_FILE:LOG_NONE);
DBUG_PRINT("info",("Got signal: %d abort_loop: %d",sig,abort_loop));
if (!abort_loop)
@ -3642,15 +3642,13 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
/* reenable logs after the options were reloaded */
if (log_output_options & LOG_NONE)
{
logger.set_handlers(LOG_FILE,
global_system_variables.sql_log_slow ?
logger.set_handlers(global_system_variables.sql_log_slow ?
LOG_TABLE : LOG_NONE,
opt_log ? LOG_TABLE : LOG_NONE);
}
else
{
logger.set_handlers(LOG_FILE,
global_system_variables.sql_log_slow ?
logger.set_handlers(global_system_variables.sql_log_slow ?
log_output_options : LOG_NONE,
opt_log ? log_output_options : LOG_NONE);
}
@ -5571,7 +5569,7 @@ static int init_server_components()
sql_print_warning("There were other values specified to "
"log-output besides NONE. Disabling slow "
"and general logs anyway.");
logger.set_handlers(LOG_FILE, LOG_NONE, LOG_NONE);
logger.set_handlers(LOG_NONE, LOG_NONE);
}
else
{
@ -5587,8 +5585,7 @@ static int init_server_components()
/* purecov: end */
}
logger.set_handlers(LOG_FILE,
global_system_variables.sql_log_slow ?
logger.set_handlers(global_system_variables.sql_log_slow ?
log_output_options:LOG_NONE,
opt_log ? log_output_options:LOG_NONE);
}