summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-01-15 11:50:15 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-01-15 12:12:59 +0200
commit71e9f0d123e201141c80a240d50347ab36ce126f (patch)
tree32941a418461691e7890175bf99196b25699dfbf
parentb4c471099dfd6c94ada59911ada236e6831b5508 (diff)
downloadmariadb-git-71e9f0d123e201141c80a240d50347ab36ce126f.tar.gz
MDEV-17797 Add ASAN poisoning for mem_heap_t
The merge commit d833bb65d53b9a4375fa71cc485b4719fdb0ee53 did not correctly merge the commit 03eb15933da9944e821bc8c787f84de50e823da0. Closes #948
-rw-r--r--storage/innobase/include/univ.i11
-rw-r--r--storage/innobase/row/row0ftsort.cc7
-rw-r--r--storage/xtradb/include/univ.i11
-rw-r--r--storage/xtradb/row/row0ftsort.cc7
4 files changed, 16 insertions, 20 deletions
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index a9d886607c0..5027b9cab5e 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -585,12 +585,14 @@ typedef void* os_thread_ret_t;
#include "ut0dbg.h"
#include "ut0ut.h"
#include "db0err.h"
+#include <my_valgrind.h>
+/* define UNIV macros in terms of my_valgrind.h */
+#define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size)
+#define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size)
+#define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size)
#ifdef UNIV_DEBUG_VALGRIND
# include <valgrind/memcheck.h>
# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size)
-# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
-# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size)
-# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
# define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr)
# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \
@@ -625,9 +627,6 @@ typedef void* os_thread_ret_t;
} while (0)
#else
# define UNIV_MEM_VALID(addr, size) do {} while(0)
-# define UNIV_MEM_INVALID(addr, size) do {} while(0)
-# define UNIV_MEM_FREE(addr, size) do {} while(0)
-# define UNIV_MEM_ALLOC(addr, size) do {} while(0)
# define UNIV_MEM_DESC(addr, size) do {} while(0)
# define UNIV_MEM_UNDESC(b) do {} while(0)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0)
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 757e268c3a7..ccc26478c72 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -741,7 +741,7 @@ loop:
goto func_exit;
}
- UNIV_MEM_INVALID(block[t_ctx.buf_used][0], srv_sort_buf_size);
+ UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size);
buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]);
mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used];
t_ctx.rows_added[t_ctx.buf_used] = 0;
@@ -834,8 +834,7 @@ exit:
goto func_exit;
}
- UNIV_MEM_INVALID(block[i][0],
- srv_sort_buf_size);
+ UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
}
buf[i] = row_merge_buf_empty(buf[i]);
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 5df8a10bcf9..e9ff9103fdd 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -607,12 +607,14 @@ typedef void* os_thread_ret_t;
#include "ut0dbg.h"
#include "ut0ut.h"
#include "db0err.h"
+#include <my_valgrind.h>
+/* define UNIV macros in terms of my_valgrind.h */
+#define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size)
+#define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size)
+#define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size)
#ifdef UNIV_DEBUG_VALGRIND
# include <valgrind/memcheck.h>
# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size)
-# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
-# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size)
-# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
# define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr)
# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \
@@ -647,9 +649,6 @@ typedef void* os_thread_ret_t;
} while (0)
#else
# define UNIV_MEM_VALID(addr, size) do {} while(0)
-# define UNIV_MEM_INVALID(addr, size) do {} while(0)
-# define UNIV_MEM_FREE(addr, size) do {} while(0)
-# define UNIV_MEM_ALLOC(addr, size) do {} while(0)
# define UNIV_MEM_DESC(addr, size) do {} while(0)
# define UNIV_MEM_UNDESC(b) do {} while(0)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0)
diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc
index bb9821d4484..d5df122c9a8 100644
--- a/storage/xtradb/row/row0ftsort.cc
+++ b/storage/xtradb/row/row0ftsort.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -744,7 +744,7 @@ loop:
goto func_exit;
}
- UNIV_MEM_INVALID(block[t_ctx.buf_used][0], srv_sort_buf_size);
+ UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size);
buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]);
mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used];
t_ctx.rows_added[t_ctx.buf_used] = 0;
@@ -837,8 +837,7 @@ exit:
goto func_exit;
}
- UNIV_MEM_INVALID(block[i][0],
- srv_sort_buf_size);
+ UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
}
buf[i] = row_merge_buf_empty(buf[i]);