Commit ab406990 authored by Marko Mäkelä's avatar Marko Mäkelä

After-merge fix for ASAN and MSAN

The merge commit 0fd89a1a
of commit b6ec1e8b
seems to cause occasional MemorySanitizer failures,
because it failed to replace some MEM_UNDEFINED() calls
with MEM_MAKE_ADDRESSABLE().

my_large_free(): Correctly invoke MEM_MAKE_ADDRESSABLE() after
freeing memory. Failure to do so could cause bogus
AddressSanitizer failures for memory allocated by my_large_malloc().
On MemorySanitizer, we will do nothing.

buf_pool_t::chunk_t::create(): Replace the MEM_MAKE_ADDRESSABLE()
that had been added in commit 48493132
to work around the issue.
parent 90d5d906
......@@ -421,9 +421,11 @@ void my_large_free(void *ptr, size_t size)
{
my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, errno);
}
# if !__has_feature(memory_sanitizer)
else
{
MEM_UNDEFINED(ptr, size);
MEM_MAKE_ADDRESSABLE(ptr, size);
# endif
}
#elif defined(_WIN32)
/*
......@@ -435,9 +437,11 @@ void my_large_free(void *ptr, size_t size)
my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size,
GetLastError());
}
# if !__has_feature(memory_sanitizer)
else
{
MEM_UNDEFINED(ptr, size);
MEM_MAKE_ADDRESSABLE(ptr, size);
# endif
}
#else
my_free_lock(ptr);
......
......@@ -1356,7 +1356,7 @@ inline bool buf_pool_t::chunk_t::create(size_t bytes)
if (UNIV_UNLIKELY(!mem))
return false;
MEM_MAKE_ADDRESSABLE(mem, mem_size());
MEM_UNDEFINED(mem, mem_size());
#ifdef HAVE_LIBNUMA
if (srv_numa_interleave)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment