diff options
author | Sujatha <sujatha.sivakumar@mariadb.com> | 2020-06-17 10:48:28 +0530 |
---|---|---|
committer | Sujatha <sujatha.sivakumar@mariadb.com> | 2020-06-25 16:14:23 +0530 |
commit | 3bc89395529b099ef744953263ddc10b1f0ea1bd (patch) | |
tree | da4ae59f9122dff27e9e808d65721bf627ddaf71 /sql/rpl_rli.cc | |
parent | bebc57642259f07f9da0bd12243a6561231c4b55 (diff) | |
download | mariadb-git-3bc89395529b099ef744953263ddc10b1f0ea1bd.tar.gz |
MDEV-22806: MSAN reports use-of-uninitialized-value for rpl_parallel_conflicts.test
Problem:
========
Relay_log_info::flush reports following MSAN issue.
==17820==WARNING: MemorySanitizer: use-of-uninitialized-value is reported
#5 0x00005584f0981441 in my_write (Filedes=22,
Buffer=0x72500003e818 "5\n./slave-relay-bin.000003\n21385\n
master-bin.000001\n21643\n0\n", '\245' <repeats 141 times>..., Count=118,
MyFlags=532) at /home/sujatha/bug_repo/test-10.5-msan/mysys/my_write.c:49
Analysis:
=========
In parallel replication at the end of each statement execution the worker execution
status is updated in 'relay-log.info' file. When two workers try to flush
the status at the same time, since the write to cache is not serialized both
workers write to the same address simultaneously and increment the
length twice. Because of this the length of buffer is more than actual data.
When flush code tries to read the buffer beyond valid data length MSAN
reports uninitialized values error.
Fix:
===
Serialize the relay log flush operation using "rli->data_lock".
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r-- | sql/rpl_rli.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 905462ecfbd..c196a65809a 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1445,8 +1445,14 @@ bool Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd, } DBUG_EXECUTE_IF("inject_crash_before_flush_rli", DBUG_SUICIDE();); if (mi->using_gtid == Master_info::USE_GTID_NO) + { + if (rgi->is_parallel_exec) + mysql_mutex_lock(&data_lock); if (flush_relay_log_info(this)) error= 1; + if (rgi->is_parallel_exec) + mysql_mutex_unlock(&data_lock); + } DBUG_EXECUTE_IF("inject_crash_after_flush_rli", DBUG_SUICIDE();); } DBUG_RETURN(error); |