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/row/row0log.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/row/row0log.cc')
-rw-r--r-- | storage/innobase/row/row0log.cc | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 43deb344346..a3bf91a1c74 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -372,9 +372,7 @@ row_log_online_op( goto err_exit; } -#ifdef HAVE_valgrind MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf); -#endif /* HAVE_valgrind */ ut_ad(log->tail.bytes < srv_sort_buf_size); avail_size = srv_sort_buf_size - log->tail.bytes; @@ -459,10 +457,8 @@ write_failed: index->type |= DICT_CORRUPT; } -#ifdef HAVE_valgrind MEM_UNDEFINED(log->tail.block, srv_sort_buf_size); MEM_UNDEFINED(buf, srv_sort_buf_size); -#endif /* HAVE_valgrind */ memcpy(log->tail.block, log->tail.buf + avail_size, mrec_size - avail_size); @@ -472,9 +468,7 @@ write_failed: ut_ad(b == log->tail.block + log->tail.bytes); } -#ifdef HAVE_valgrind MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf); -#endif /* HAVE_valgrind */ err_exit: mutex_exit(&log->mutex); } @@ -506,9 +500,7 @@ row_log_table_open( { mutex_enter(&log->mutex); -#ifdef HAVE_valgrind MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf); -#endif /* HAVE_valgrind */ if (log->error != DB_SUCCESS) { err_exit: @@ -600,10 +592,9 @@ row_log_table_close_func( write_failed: log->error = DB_ONLINE_LOG_TOO_BIG; } -#ifdef HAVE_valgrind + MEM_UNDEFINED(log->tail.block, srv_sort_buf_size); MEM_UNDEFINED(buf, srv_sort_buf_size); -#endif /* HAVE_valgrind */ memcpy(log->tail.block, log->tail.buf + avail, size - avail); log->tail.bytes = size - avail; } else { @@ -612,9 +603,7 @@ write_failed: } log->tail.total += size; -#ifdef HAVE_valgrind MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf); -#endif /* HAVE_valgrind */ err_exit: mutex_exit(&log->mutex); @@ -2785,9 +2774,7 @@ row_log_table_apply_ops( ut_ad(new_trx_id_col > 0); ut_ad(new_trx_id_col != ULINT_UNDEFINED); -#ifdef HAVE_valgrind MEM_UNDEFINED(&mrec_end, sizeof mrec_end); -#endif /* HAVE_valgrind */ offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets)); rec_offs_set_n_alloc(offsets, i); @@ -3696,9 +3683,8 @@ row_log_apply_ops( ut_ad(!index->is_committed()); ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_X)); ut_ad(index->online_log); -#ifdef HAVE_valgrind + MEM_UNDEFINED(&mrec_end, sizeof mrec_end); -#endif /* HAVE_valgrind */ offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets)); rec_offs_set_n_alloc(offsets, i); |