From e1f9ed42bb01f6a1351f275a5e3e8031c353765d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 30 Nov 2012 17:26:50 +0000 Subject: [PATCH] tsan: add sanity checks into memory allocator git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@169015 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/sanitizer_common/sanitizer_allocator64.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/sanitizer_common/sanitizer_allocator64.h b/lib/sanitizer_common/sanitizer_allocator64.h index 2f4e69741..f045bdea9 100644 --- a/lib/sanitizer_common/sanitizer_allocator64.h +++ b/lib/sanitizer_common/sanitizer_allocator64.h @@ -460,11 +460,13 @@ class LargeMmapAllocator { }; Header *GetHeader(uptr p) { + CHECK_EQ(p % page_size_, 0); return reinterpret_cast(p - page_size_); } Header *GetHeader(void *p) { return GetHeader(reinterpret_cast(p)); } void *GetUser(Header *h) { + CHECK_EQ((uptr)h % page_size_, 0); return reinterpret_cast(reinterpret_cast(h) + page_size_); } -- 2.11.4.GIT