diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2018-07-20 08:33:41 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2018-07-20 08:33:41 +0000 |
commit | 6b978a22fee3b73549f49349603e8c2ddc63cd8d (patch) | |
tree | 4ae52edf862ea525b802848fb8b7a030d2ddfb6b /lib/sanitizer_common/sanitizer_common.h | |
parent | 2fc7d929d85ec6534209a33988fa5abdfb675765 (diff) | |
download | compiler-rt-6b978a22fee3b73549f49349603e8c2ddc63cd8d.tar.gz |
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/sanitizer_common/sanitizer_common.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_common.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sanitizer_common/sanitizer_common.h b/lib/sanitizer_common/sanitizer_common.h index c37db56d3..3b999edfb 100644 --- a/lib/sanitizer_common/sanitizer_common.h +++ b/lib/sanitizer_common/sanitizer_common.h @@ -88,8 +88,8 @@ void UnmapOrDie(void *addr, uptr size); // Behaves just like MmapOrDie, but tolerates out of memory condition, in that // case returns nullptr. void *MmapOrDieOnFatalError(uptr size, const char *mem_type); -void *MmapFixedNoReserve(uptr fixed_addr, uptr size, - const char *name = nullptr); +bool MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name = nullptr) + WARN_UNUSED_RESULT; void *MmapNoReserveOrDie(uptr size, const char *mem_type); void *MmapFixedOrDie(uptr fixed_addr, uptr size); // Behaves just like MmapFixedOrDie, but tolerates out of memory condition, in |