mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 14:11:58 +00:00
fix
This commit is contained in:
parent
17dd579dac
commit
bdd3bc8169
@ -57,9 +57,7 @@ private:
|
||||
end = begin + size_ - pad_right;
|
||||
prev = prev_;
|
||||
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_POISON_MEMORY_REGION(begin, size_);
|
||||
#endif
|
||||
}
|
||||
|
||||
~Chunk()
|
||||
@ -68,9 +66,7 @@ private:
|
||||
/// because the allocator might not have asan integration, and the
|
||||
/// memory would stay poisoned forever. If the allocator supports
|
||||
/// asan, it will correctly poison the memory by itself.
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_UNPOISON_MEMORY_REGION(begin, size());
|
||||
#endif
|
||||
|
||||
Allocator<false>::free(begin, size());
|
||||
|
||||
@ -142,9 +138,7 @@ public:
|
||||
char * res = head->pos;
|
||||
head->pos += size;
|
||||
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_UNPOISON_MEMORY_REGION(res, size + pad_right);
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -163,9 +157,7 @@ public:
|
||||
head->pos = static_cast<char *>(head_pos);
|
||||
head->pos += size;
|
||||
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_UNPOISON_MEMORY_REGION(res, size + pad_right);
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -186,9 +178,7 @@ public:
|
||||
void rollback(size_t size)
|
||||
{
|
||||
head->pos -= size;
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_POISON_MEMORY_REGION(head->pos, size + pad_right);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Begin or expand allocation of contiguous piece of memory without alignment.
|
||||
@ -215,9 +205,7 @@ public:
|
||||
if (!begin)
|
||||
begin = res;
|
||||
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_UNPOISON_MEMORY_REGION(res, size + pad_right);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -250,9 +238,7 @@ public:
|
||||
if (!begin)
|
||||
begin = res;
|
||||
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_UNPOISON_MEMORY_REGION(res, size + pad_right);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -263,9 +249,7 @@ public:
|
||||
if (old_data)
|
||||
{
|
||||
memcpy(res, old_data, old_size);
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_POISON_MEMORY_REGION(old_data, old_size);
|
||||
#endif
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -276,9 +260,7 @@ public:
|
||||
if (old_data)
|
||||
{
|
||||
memcpy(res, old_data, old_size);
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_POISON_MEMORY_REGION(old_data, old_size);
|
||||
#endif
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
# include <sanitizer/asan_interface.h>
|
||||
#endif
|
||||
#include <Core/Defines.h>
|
||||
#include <Common/Arena.h>
|
||||
#include <Common/BitHelpers.h>
|
||||
|
||||
@ -70,10 +71,8 @@ public:
|
||||
/// item in the list. We poisoned the free block before putting
|
||||
/// it into the free list, so we have to unpoison it before
|
||||
/// reading anything.
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_UNPOISON_MEMORY_REGION(free_block_ptr,
|
||||
std::max(size, sizeof(Block)));
|
||||
#endif
|
||||
|
||||
const auto res = free_block_ptr->data;
|
||||
free_block_ptr = free_block_ptr->next;
|
||||
@ -104,9 +103,7 @@ public:
|
||||
/// destructor, to support an underlying allocator that doesn't
|
||||
/// integrate with asan. We don't do that, and rely on the fact that
|
||||
/// our underlying allocator is Arena, which does have asan integration.
|
||||
#if __has_include(<sanitizer/asan_interface.h>)
|
||||
ASAN_POISON_MEMORY_REGION(ptr, 1ULL << (list_idx + 1));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Size of the allocated pool in bytes
|
||||
|
@ -139,3 +139,8 @@
|
||||
/// This number is only used for distributed version compatible.
|
||||
/// It could be any magic number.
|
||||
#define DBMS_DISTRIBUTED_SENDS_MAGIC_NUMBER 0xCAFECABE
|
||||
|
||||
#if !__has_include(<sanitizer/asan_interface.h>)
|
||||
# define ASAN_UNPOISON_MEMORY_REGION(a,b)
|
||||
# define ASAN_POISON_MEMORY_REGION(a,b)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user