diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 16:52:13 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-07-02 17:59:28 +0300 |
commit | b6ec1e8bbf0ffca2d715aded694722e0c4b5d484 (patch) | |
tree | 50a26d45267de2570fe0761f1776aa1397252c93 /storage/innobase/trx/trx0trx.cc | |
parent | 65f831d17c84900c1faea49164688e2f5ce59563 (diff) | |
download | mariadb-git-b6ec1e8bbf0ffca2d715aded694722e0c4b5d484.tar.gz |
MDEV-20377 post-fix: Introduce MEM_MAKE_ADDRESSABLE
In AddressSanitizer, we only want memory poisoning to happen
in connection with custom memory allocation or freeing.
The primary use of MEM_UNDEFINED is for declaring memory uninitialized
in Valgrind or MemorySanitizer. We do not want MEM_UNDEFINED to
have the unwanted side effect that AddressSanitizer would no longer
be able to complain about accessing unallocated memory.
MEM_UNDEFINED(): Define as no-op for AddressSanitizer.
MEM_MAKE_ADDRESSABLE(): Define as MEM_UNDEFINED() or
ASAN_UNPOISON_MEMORY_REGION().
MEM_CHECK_ADDRESSABLE(): Wrap also __asan_region_is_poisoned().
Diffstat (limited to 'storage/innobase/trx/trx0trx.cc')
-rw-r--r-- | storage/innobase/trx/trx0trx.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index c9b559c7307..e0d8d44a86e 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -453,12 +453,11 @@ void trx_free(trx_t*& trx) #ifdef __SANITIZE_ADDRESS__ /* Unpoison the memory for innodb_monitor_set_option; it is operating also on the freed transaction objects. */ - MEM_UNDEFINED(&trx->mutex, sizeof trx->mutex); + MEM_MAKE_ADDRESSABLE(&trx->mutex, sizeof trx->mutex); /* For innobase_kill_connection() */ - MEM_UNDEFINED(&trx->state, sizeof trx->state); - MEM_UNDEFINED(&trx->mysql_thd, sizeof trx->mysql_thd); + MEM_MAKE_ADDRESSABLE(&trx->state, sizeof trx->state); + MEM_MAKE_ADDRESSABLE(&trx->mysql_thd, sizeof trx->mysql_thd); #endif -#ifdef HAVE_valgrind /* Unpoison the memory for innodb_monitor_set_option; it is operating also on the freed transaction objects. We checked that these were initialized in @@ -467,7 +466,6 @@ void trx_free(trx_t*& trx) /* For innobase_kill_connection() */ MEM_MAKE_DEFINED(&trx->state, sizeof trx->state); MEM_MAKE_DEFINED(&trx->mysql_thd, sizeof trx->mysql_thd); -#endif trx = NULL; } |