summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_fuchsia.cc
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2017-10-12 03:23:31 +0000
committerHans Wennborg <hans@hanshq.net>2017-10-12 03:23:31 +0000
commit286d9a10aba57923d2a1c193b930580f34f3123b (patch)
treeaa338870d0f235d728768efd35ed92ed9073bcd8 /lib/sanitizer_common/sanitizer_fuchsia.cc
parent8c026f72295bb6b6a9aa0e2673baba6c17b33e26 (diff)
Revert r315533 "Reland "[sanitizer] Introduce ReservedAddressRange to sanitizer_common""
The SanitizerCommon.ReservedAddressRangeUnmap test fails on Windows: FAIL: SanitizerCommon-Unit :: ./Sanitizer-x86_64-Test.exe/SanitizerCommon.ReservedAddressRangeUnmap (34003 of 35554) ******************** TEST 'SanitizerCommon-Unit :: ./Sanitizer-x86_64-Test.exe/SanitizerCommon.ReservedAddressRangeUnmap' FAILED ******************** Note: Google Test filter = SanitizerCommon.ReservedAddressRangeUnmap [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from SanitizerCommon [ RUN ] SanitizerCommon.ReservedAddressRangeUnmap ==3780==ERROR: SanitizerTool failed to deallocate 0x1000 (4096) bytes at address 0x0000000c3000 (error code: 487) ==3780==Sanitizer CHECK failed: E:\b\build\slave\win_upload_clang\build\src\third_party\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_win.cc:129 (("unable to unmap" && 0)) != (0) (0, 0) ******************** Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. Testing Time: 299.76s ******************** Failing Tests (1): SanitizerCommon-Unit :: ./Sanitizer-x86_64-Test.exe/SanitizerCommon.ReservedAddressRangeUnmap > In Fuchsia, MmapNoAccess/MmapFixedOrDie are implemented using a global > VMAR, which means that MmapNoAccess can only be called once. This works > for the sanitizer allocator but *not* for the Scudo allocator. > > Hence, this changeset introduces a new ReservedAddressRange object to > serve as the new API for these calls. In this changeset, the object > still calls into the old Mmap implementations. > > The next changeset two changesets will convert the sanitizer and scudo > allocators to use the new APIs, respectively. (ReservedAddressRange will > replace the SecondaryHeader in Scudo.) > > Finally, a last changeset will update the Fuchsia implementation. > > Patch by Julia Hansbrough > > Differential Revision: https://reviews.llvm.org/D38437 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315553 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_fuchsia.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_fuchsia.cc31
1 files changed, 0 insertions, 31 deletions
diff --git a/lib/sanitizer_common/sanitizer_fuchsia.cc b/lib/sanitizer_common/sanitizer_fuchsia.cc
index 00a8aabbf..21fabddb1 100644
--- a/lib/sanitizer_common/sanitizer_fuchsia.cc
+++ b/lib/sanitizer_common/sanitizer_fuchsia.cc
@@ -236,37 +236,6 @@ void *MmapOrDieOnFatalError(uptr size, const char *mem_type) {
return DoAnonymousMmapOrDie(size, mem_type, false, false);
}
-uptr ReservedAddressRange::Init(uptr init_size, const char* name = nullptr,
- uptr fixed_addr = uptr(0)) {
- base_ = MmapNoAccess(init_size);
- size_ = size;
- name_ = name;
- return reinterpret_cast<uptr>(base_);
-}
-
-// Uses fixed_addr for now.
-// Will use offset instead once we've implemented this function for real.
-uptr ReservedAddressRange::Map(uptr fixed_addr, uptr map_size,
- bool tolerate_enomem = true) {
- return reinterpret_cast<uptr>(MmapFixedOrDie(fixed_addr, size,
- tolerate_enomem));
-}
-
-void ReservedAddressRange::Unmap(uptr addr, uptr size) {
- void* addr_as_void = reinterpret_cast<void*>(addr);
- uptr base_as_uptr = reinterpret_cast<uptr>(base_);
- // Only unmap at the beginning or end of the range.
- CHECK_EQ((addr_as_void == base_) || (addr + size == base_as_uptr + size_),
- true);
- // Detect overflows.
- CHECK_LE(size, (base_as_uptr + size_) - addr);
- UnmapOrDie(reinterpret_cast<void*>(addr), size);
- if (addr_as_void == base_) {
- base_ = reinterpret_cast<void*>(addr + size);
- }
- size_ = size_ - size;
-}
-
// MmapNoAccess and MmapFixedOrDie are used only by sanitizer_allocator.
// Instead of doing exactly what they say, we make MmapNoAccess actually
// just allocate a VMAR to reserve the address space. Then MmapFixedOrDie