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

@ -1561,13 +1561,9 @@ bool Log_to_csv_event_handler::init()
return 0;
}
int LOGGER::set_handlers(ulonglong error_log_printer,
ulonglong slow_log_printer,
int LOGGER::set_handlers(ulonglong slow_log_printer,
ulonglong general_log_printer)
{
/* error log table is not supported yet */
DBUG_ASSERT(error_log_printer < LOG_TABLE);
lock_exclusive();
if ((slow_log_printer & LOG_TABLE || general_log_printer & LOG_TABLE) &&
@ -1580,7 +1576,6 @@ int LOGGER::set_handlers(ulonglong error_log_printer,
"Falling back to the old-fashioned logs");
}
init_error_log(error_log_printer);
init_slow_log(slow_log_printer);
init_general_log(general_log_printer);