[llvm-commits] [compiler-rt] r169015 - /compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h
Dmitry Vyukov
dvyukov at google.com
Fri Nov 30 09:26:50 PST 2012
Author: dvyukov
Date: Fri Nov 30 11:26:50 2012
New Revision: 169015
URL: http://llvm.org/viewvc/llvm-project?rev=169015&view=rev
Log:
tsan: add sanity checks into memory allocator
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h?rev=169015&r1=169014&r2=169015&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h Fri Nov 30 11:26:50 2012
@@ -460,11 +460,13 @@
};
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_);
}
More information about the llvm-commits
mailing list