summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-11-30 17:26:50 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-11-30 17:26:50 +0000
commitad9c530f7c0c92eaa8d6f98d9aca164b8dfa0365 (patch)
tree143ad70f67045052718a1e12484b647e25cb62a8
parent43d50d4a354d0f425349f50e922199e140d40482 (diff)
downloadbcm5719-llvm-ad9c530f7c0c92eaa8d6f98d9aca164b8dfa0365.tar.gz
bcm5719-llvm-ad9c530f7c0c92eaa8d6f98d9aca164b8dfa0365.zip
tsan: add sanity checks into memory allocator
llvm-svn: 169015
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_allocator64.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator64.h
index 2f4e697415d..f045bdea95a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator64.h
+++ b/compiler-rt/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<Header*>(p - page_size_);
}
Header *GetHeader(void *p) { return GetHeader(reinterpret_cast<uptr>(p)); }
void *GetUser(Header *h) {
+ CHECK_EQ((uptr)h % page_size_, 0);
return reinterpret_cast<void*>(reinterpret_cast<uptr>(h) + page_size_);
}
OpenPOWER on IntegriCloud