diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2012-11-06 15:39:16 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2012-11-06 15:39:16 +0000 |
commit | 785a7c07c9bd2d4463b30a8539a716f020139551 (patch) | |
tree | 01151f119a693eb4603f14a6500a1e78bc012586 | |
parent | 65d601e996bd9721fca268da267380d95f93d82d (diff) | |
download | compiler-rt-785a7c07c9bd2d4463b30a8539a716f020139551.tar.gz |
tsan: better diagnostics for failed mmap()
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@167462 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/sanitizer_common/sanitizer_posix.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_posix.cc b/lib/sanitizer_common/sanitizer_posix.cc index 035ddbcdb..d91a2e136 100644 --- a/lib/sanitizer_common/sanitizer_posix.cc +++ b/lib/sanitizer_common/sanitizer_posix.cc @@ -74,10 +74,14 @@ void UnmapOrDie(void *addr, uptr size) { } void *MmapFixedNoReserve(uptr fixed_addr, uptr size) { - return internal_mmap((void*)fixed_addr, size, + void *p = internal_mmap((void*)fixed_addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_FIXED | MAP_NORESERVE, -1, 0); + if (p != (void*)fixed_addr) + Report("ERROR: Failed to deallocate 0x%zx (%zd) bytes at address %p (%d)\n", + size, size, fixed_addr, errno); + return p; } void *Mprotect(uptr fixed_addr, uptr size) { |