summaryrefslogtreecommitdiff
path: root/include/my_valgrind.h
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2018-09-19 22:01:00 +0300
committerEugene Kosov <claprix@yandex.ru>2018-09-21 10:17:37 +0300
commit5b25dc6fa4bf63d783e8f8db73abc22ab111143b (patch)
tree283f6d4b1b51b56f32e972a65a7eabaf5e834c74 /include/my_valgrind.h
parente43bc02e7b2752f0deb88cd1edc24d827e01dca9 (diff)
downloadmariadb-git-5b25dc6fa4bf63d783e8f8db73abc22ab111143b.tar.gz
MDEV-17248 Improve ASAN memory pool instrumentation
alloc_root(): unpoison only requested amount of bytes instead of a possible bigger aligned-sized buffer.
Diffstat (limited to 'include/my_valgrind.h')
-rw-r--r--include/my_valgrind.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 8dde079b976..5d08a271d4a 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -49,9 +49,9 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
#endif /* HAVE_VALGRIND */
#ifndef DBUG_OFF
-#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED(A,B); memset(A,C,B); } while(0)
+#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_UNDEFINED(A, trash_tmp); memset(A, C, trash_tmp); } while (0)
#else
-#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED(A,B); } while(0)
+#define TRASH_FILL(A,B,C) do { const size_t trash_tmp __attribute__((unused))= (B); MEM_UNDEFINED(A,trash_tmp); } while (0)
#endif
#define TRASH_ALLOC(A,B) do { TRASH_FILL(A,B,0xA5); MEM_UNDEFINED(A,B); } while(0)
#define TRASH_FREE(A,B) do { TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0)