diff options
author | Eugene Kosov <claprix@yandex.ru> | 2018-11-28 13:25:43 +0300 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-05-20 18:18:23 +0200 |
commit | 7b59ec6f345986db0cbc6f8b1d504a6e7e21cb5f (patch) | |
tree | 3596af6e2ebd502982e1835030306c7d38931699 /include | |
parent | 2c9844a438c5f0bddcb037a1e05978118f48abb6 (diff) | |
download | mariadb-git-7b59ec6f345986db0cbc6f8b1d504a6e7e21cb5f.tar.gz |
MDEV-17799 Add ASAN-poisoned redzones for MEM_ROOT and mem_heap_t
This patch is for MEM_ROOT only.
In debug mode add 8 byte of poisoned memory before every allocated chunk.
On the right of every chunk there will be either 1-7 trailing poisoned bytes, or
next chunk's redzone, or poisoned non allocated memory or redzone of a
malloc()ed buffer.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_valgrind.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/my_valgrind.h b/include/my_valgrind.h index 6df8f5a772e..14db2af2cb3 100644 --- a/include/my_valgrind.h +++ b/include/my_valgrind.h @@ -13,6 +13,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ +#ifndef _my_valgrind_h +#define _my_valgrind_h + /* clang -> gcc */ #ifndef __has_feature # define __has_feature(x) 0 @@ -49,9 +52,13 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */ #endif /* HAVE_VALGRIND */ #ifndef DBUG_OFF +static const size_t REDZONE_SIZE= 8; #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 +static const size_t REDZONE_SIZE= 0; #define TRASH_FILL(A,B,C) do { MEM_UNDEFINED((A), (B)); } 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) + +#endif /* _my_valgrind_h */ |