Skip to content

Commit ab40699

Browse files
committed
After-merge fix for ASAN and MSAN
The merge commit 0fd89a1 of commit b6ec1e8 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 4849313 to work around the issue.
1 parent 90d5d90 commit ab40699

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

mysys/my_largepage.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,11 @@ void my_large_free(void *ptr, size_t size)
421421
{
422422
my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, errno);
423423
}
424+
# if !__has_feature(memory_sanitizer)
424425
else
425426
{
426-
MEM_UNDEFINED(ptr, size);
427+
MEM_MAKE_ADDRESSABLE(ptr, size);
428+
# endif
427429
}
428430
#elif defined(_WIN32)
429431
/*
@@ -435,9 +437,11 @@ void my_large_free(void *ptr, size_t size)
435437
my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size,
436438
GetLastError());
437439
}
440+
# if !__has_feature(memory_sanitizer)
438441
else
439442
{
440-
MEM_UNDEFINED(ptr, size);
443+
MEM_MAKE_ADDRESSABLE(ptr, size);
444+
# endif
441445
}
442446
#else
443447
my_free_lock(ptr);

storage/innobase/buf/buf0buf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ inline bool buf_pool_t::chunk_t::create(size_t bytes)
13561356
if (UNIV_UNLIKELY(!mem))
13571357
return false;
13581358

1359-
MEM_MAKE_ADDRESSABLE(mem, mem_size());
1359+
MEM_UNDEFINED(mem, mem_size());
13601360

13611361
#ifdef HAVE_LIBNUMA
13621362
if (srv_numa_interleave)

0 commit comments

Comments
 (0)