summaryrefslogtreecommitdiff
path: root/lib/msan/msan_linux.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-07-20 08:33:41 +0000
committerDmitry Vyukov <dvyukov@google.com>2018-07-20 08:33:41 +0000
commit6b978a22fee3b73549f49349603e8c2ddc63cd8d (patch)
tree4ae52edf862ea525b802848fb8b7a030d2ddfb6b /lib/msan/msan_linux.cc
parent2fc7d929d85ec6534209a33988fa5abdfb675765 (diff)
sanitizers: consistently check result of MmapFixedNoReserve
MmapFixedNoReserve does not terminate process on failure. Failure to check its result and die will always lead to harder to debug crashes later in execution. This was observed in Go processes due to some address space conflicts. Consistently check result of MmapFixedNoReserve. While we are here also add warn_unused_result attribute to prevent such bugs in future and change return type to bool as that's what all callers want. Reviewed in https://reviews.llvm.org/D49367 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337531 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan_linux.cc')
-rw-r--r--lib/msan/msan_linux.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc
index 973e6620e..385a650c4 100644
--- a/lib/msan/msan_linux.cc
+++ b/lib/msan/msan_linux.cc
@@ -143,7 +143,7 @@ bool InitShadow(bool init_origins) {
if (map) {
if (!CheckMemoryRangeAvailability(start, size))
return false;
- if ((uptr)MmapFixedNoReserve(start, size, kMemoryLayout[i].name) != start)
+ if (!MmapFixedNoReserve(start, size, kMemoryLayout[i].name))
return false;
if (common_flags()->use_madv_dontdump)
DontDumpShadowMemory(start, size);