diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-10-12 03:23:31 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-10-12 03:23:31 +0000 |
commit | 286d9a10aba57923d2a1c193b930580f34f3123b (patch) | |
tree | aa338870d0f235d728768efd35ed92ed9073bcd8 /lib/sanitizer_common/tests | |
parent | 8c026f72295bb6b6a9aa0e2673baba6c17b33e26 (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/tests')
-rw-r--r-- | lib/sanitizer_common/tests/sanitizer_common_test.cc | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/lib/sanitizer_common/tests/sanitizer_common_test.cc b/lib/sanitizer_common/tests/sanitizer_common_test.cc index 5efce86ce..9c62b4593 100644 --- a/lib/sanitizer_common/tests/sanitizer_common_test.cc +++ b/lib/sanitizer_common/tests/sanitizer_common_test.cc @@ -320,66 +320,4 @@ TEST(SanitizerCommon, GetRandom) { } #endif -TEST(SanitizerCommon, ReservedAddressRangeInit) { - uptr init_size = 0xffff; - ReservedAddressRange address_range; - uptr res = address_range.Init(init_size); - CHECK_NE(res, (void*)-1); - UnmapOrDie((void*)res, init_size); - // Should be able to map into the same space now. - ReservedAddressRange address_range2; - uptr res2 = address_range2.Init(init_size, nullptr, res); - CHECK_EQ(res, res2); - - // TODO(flowerhack): Once this is switched to the "real" implementation - // (rather than passing through to MmapNoAccess*), enforce and test "no - // double initializations allowed" -} - -TEST(SanitizerCommon, ReservedAddressRangeMap) { - constexpr uptr init_size = 0xffff; - ReservedAddressRange address_range; - uptr res = address_range.Init(init_size); - CHECK_NE(res, (void*) -1); - - // Valid mappings should succeed. - CHECK_EQ(res, address_range.Map(res, init_size)); - - // Valid mappings should be readable. - unsigned char buffer[init_size]; - memcpy(buffer, &res, sizeof(buffer)); - - // Invalid mappings should fail. - EXPECT_DEATH(address_range.Map(res, 0), ".*"); - - // TODO(flowerhack): Once this is switched to the "real" implementation, make - // sure you can only mmap into offsets in the Init range. -} - -TEST(SanitizerCommon, ReservedAddressRangeUnmap) { - uptr PageSize = GetPageSizeCached(); - uptr init_size = PageSize * 4; - ReservedAddressRange address_range; - uptr base_addr = address_range.Init(init_size); - CHECK_NE(base_addr, (void*)-1); - CHECK_EQ(base_addr, address_range.Map(base_addr, init_size)); - - // Unmapping at the beginning should succeed. - address_range.Unmap(base_addr, PageSize); - CHECK_EQ(base_addr + PageSize, address_range.base()); - CHECK_EQ(init_size - PageSize, address_range.size()); - - // Unmapping at the end should succeed. - uptr old_size = address_range.size(); - void* old_base = address_range.base(); - uptr new_start = reinterpret_cast<uptr>(address_range.base()) + - address_range.size() - PageSize; - address_range.Unmap(new_start, PageSize); - CHECK_EQ(old_size - PageSize, address_range.size()); - CHECK_EQ(old_base, address_range.base()); - - // Unmapping in the middle of the ReservedAddressRange should fail. - EXPECT_DEATH(address_range.Unmap(base_addr + 0xf, 0xff), ".*"); -} - } // namespace __sanitizer |