diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-04 22:02:30 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-04 22:02:30 +0300 |
commit | 453dc4b300e0d595adb736fb555e62a42accfa2b (patch) | |
tree | 6b68987d68f85a0c29e2ab81c669abdfcfead14b | |
parent | 484931325e7bcecddc6daf1a55c008ddd67497e4 (diff) | |
download | mariadb-git-453dc4b300e0d595adb736fb555e62a42accfa2b.tar.gz |
Fixup the parent commit for MSAN and Valgrind
commit 484931325e7bcecddc6daf1a55c008ddd67497e4 was a necessary
fix for the buffer pool resizing tests in 10.5 in
AddressSanitizer. However, that change would break the tests
innodb.innodb_buffer_pool_resize and
innodb.innodb_buffer_pool_resize_with_chunks
when run in MemorySanitizer, or presumably in Valgrind as well.
(Those tests run "forever" in Valgrind.)
buf_pool_resize(): Cancel the effect of MEM_NOACCESS() in Valgrind
and ASAN. In MSAN, MEM_NOACCESS() is a no-op, and hence we must do
nothing special here.
MEM_MAKE_ADDRESSABLE() would declare the memory contents undefined.
In this particular case, we must actually declare the contents
defined for Valgrind.
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index c9cff9b3295..f2594725391 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1622,7 +1622,7 @@ buf_chunk_init( return(NULL); } - MEM_MAKE_ADDRESSABLE(chunk->mem, chunk->mem_size()); + MEM_MAKE_ADDRESSABLE(chunk->mem, chunk->mem_size()); #ifdef HAVE_LIBNUMA if (srv_numa_interleave) { @@ -2910,8 +2910,21 @@ withdraw_retry: while (chunk < echunk) { buf_block_t* block = chunk->blocks; - MEM_MAKE_ADDRESSABLE(chunk->mem, - chunk->mem_size()); + /* buf_LRU_block_free_non_file_page() + invokes MEM_NOACCESS() on any blocks + that are in free_list. We must + cancel the effect of that. In MemorySanitizer, + MEM_NOACCESS() is no-op, so we must not do + anything special for it here. */ +#ifdef HAVE_valgrind +# if !__has_feature(memory_sanitizer) + MEM_MAKE_DEFINED(chunk->mem, + chunk->mem_size()); +# endif +#else + MEM_MAKE_ADDRESSABLE(chunk->mem, + chunk->mem_size()); +#endif for (ulint j = chunk->size; j--; block++) { |