Commit 71e9f0d1 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-17797 Add ASAN poisoning for mem_heap_t

The merge commit d833bb65 did not
correctly merge the commit 03eb1593.

Closes #948
parent b4c47109
...@@ -585,12 +585,14 @@ typedef void* os_thread_ret_t; ...@@ -585,12 +585,14 @@ typedef void* os_thread_ret_t;
#include "ut0dbg.h" #include "ut0dbg.h"
#include "ut0ut.h" #include "ut0ut.h"
#include "db0err.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 #ifdef UNIV_DEBUG_VALGRIND
# include <valgrind/memcheck.h> # include <valgrind/memcheck.h>
# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size) # 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_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr)
# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b) # define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \ # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \
...@@ -625,9 +627,6 @@ typedef void* os_thread_ret_t; ...@@ -625,9 +627,6 @@ typedef void* os_thread_ret_t;
} while (0) } while (0)
#else #else
# define UNIV_MEM_VALID(addr, size) do {} while(0) # 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_DESC(addr, size) do {} while(0)
# define UNIV_MEM_UNDESC(b) do {} while(0) # define UNIV_MEM_UNDESC(b) do {} while(0)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0) # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0)
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -741,7 +741,7 @@ fts_parallel_tokenization( ...@@ -741,7 +741,7 @@ fts_parallel_tokenization(
goto func_exit; 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]); 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]; mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used];
t_ctx.rows_added[t_ctx.buf_used] = 0; t_ctx.rows_added[t_ctx.buf_used] = 0;
...@@ -834,8 +834,7 @@ fts_parallel_tokenization( ...@@ -834,8 +834,7 @@ fts_parallel_tokenization(
goto func_exit; goto func_exit;
} }
UNIV_MEM_INVALID(block[i][0], UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
srv_sort_buf_size);
} }
buf[i] = row_merge_buf_empty(buf[i]); buf[i] = row_merge_buf_empty(buf[i]);
......
...@@ -607,12 +607,14 @@ typedef void* os_thread_ret_t; ...@@ -607,12 +607,14 @@ typedef void* os_thread_ret_t;
#include "ut0dbg.h" #include "ut0dbg.h"
#include "ut0ut.h" #include "ut0ut.h"
#include "db0err.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 #ifdef UNIV_DEBUG_VALGRIND
# include <valgrind/memcheck.h> # include <valgrind/memcheck.h>
# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size) # 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_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr)
# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b) # define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \ # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \
...@@ -647,9 +649,6 @@ typedef void* os_thread_ret_t; ...@@ -647,9 +649,6 @@ typedef void* os_thread_ret_t;
} while (0) } while (0)
#else #else
# define UNIV_MEM_VALID(addr, size) do {} while(0) # 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_DESC(addr, size) do {} while(0)
# define UNIV_MEM_UNDESC(b) do {} while(0) # define UNIV_MEM_UNDESC(b) do {} while(0)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0) # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0)
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -744,7 +744,7 @@ fts_parallel_tokenization( ...@@ -744,7 +744,7 @@ fts_parallel_tokenization(
goto func_exit; 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]); 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]; mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used];
t_ctx.rows_added[t_ctx.buf_used] = 0; t_ctx.rows_added[t_ctx.buf_used] = 0;
...@@ -837,8 +837,7 @@ fts_parallel_tokenization( ...@@ -837,8 +837,7 @@ fts_parallel_tokenization(
goto func_exit; goto func_exit;
} }
UNIV_MEM_INVALID(block[i][0], UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
srv_sort_buf_size);
} }
buf[i] = row_merge_buf_empty(buf[i]); buf[i] = row_merge_buf_empty(buf[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment