Skip to content
Permalink
Browse files
MDEV-24053 MSAN use-of-uninitialized-value in tpool::simulated_aio::s…
…imulated_aio_callback()

Starting with commit ef3f71f
MemorySanitizer would complain that we are writing uninitialized
data via the doublewrite buffer.

buf_dblwr_t::add_to_batch(): Zero out any unused part of the
doublewrite buffer, for PAGE_COMPRESSED and ROW_FORMAT=COMPRESSED
tables.

Reviewed by: Eugene Kosov
  • Loading branch information
dr-m committed Oct 29, 2020
1 parent 8cfddda commit 6d3356c
Showing 1 changed file with 9 additions and 1 deletion.
@@ -736,7 +736,15 @@ void buf_dblwr_t::add_to_batch(const IORequest &request, size_t size)
encryption and/or page compression */
void *frame= buf_page_get_frame(request.bpage);

memcpy_aligned<OS_FILE_LOG_BLOCK_SIZE>(p, frame, size);
/* "frame" is at least 1024-byte aligned for ROW_FORMAT=COMPRESSED pages,
and at least srv_page_size (4096-byte) for everything else. */
memcpy_aligned<UNIV_ZIP_SIZE_MIN>(p, frame, size);
/* fil_page_compress() for page_compressed guarantees 256-byte alignment */
memset_aligned<256>(p + size, 0, srv_page_size - size);
/* FIXME: Inform the compiler that "size" and "srv_page_size - size"
are integer multiples of 256, so the above can translate into simple
SIMD instructions. Currently, we make no such assumptions about the
non-pointer parameters that are passed to the _aligned templates. */
ut_ad(!request.bpage->zip_size() || request.bpage->zip_size() == size);
ut_ad(active_slot->reserved == active_slot->first_free);
ut_ad(active_slot->reserved < buf_size);

0 comments on commit 6d3356c

Please sign in to comment.