diff options
Diffstat (limited to 'libartbase/base')
| -rw-r--r-- | libartbase/base/mem_map.cc | 20 | ||||
| -rw-r--r-- | libartbase/base/mem_map_test.cc | 5 |
2 files changed, 7 insertions, 18 deletions
diff --git a/libartbase/base/mem_map.cc b/libartbase/base/mem_map.cc index 9ba1d6c139..d53480d4ca 100644 --- a/libartbase/base/mem_map.cc +++ b/libartbase/base/mem_map.cc @@ -647,21 +647,11 @@ void MemMap::MadviseDontNeedAndZero() { } bool MemMap::Sync() { - bool result; - if (redzone_size_ != 0) { - // To avoid errors when running on a memory tool, temporarily lift the lower-end noaccess - // protection before passing it to msync() as it only accepts page-aligned base address, - // and exclude the higher-end noaccess protection from the msync range. b/27552451. - // TODO: Valgrind is no longer supported, but Address Sanitizer is: - // check whether this special case is needed for ASan. - uint8_t* base_begin = reinterpret_cast<uint8_t*>(base_begin_); - MEMORY_TOOL_MAKE_DEFINED(base_begin, begin_ - base_begin); - result = msync(BaseBegin(), End() - base_begin, MS_SYNC) == 0; - MEMORY_TOOL_MAKE_NOACCESS(base_begin, begin_ - base_begin); - } else { - result = msync(BaseBegin(), BaseSize(), MS_SYNC) == 0; - } - return result; + // Historical note: To avoid Valgrind errors, we temporarily lifted the lower-end noaccess + // protection before passing it to msync() when `redzone_size_` was non-null, as Valgrind + // only accepts page-aligned base address, and excludes the higher-end noaccess protection + // from the msync range. b/27552451. + return msync(BaseBegin(), BaseSize(), MS_SYNC) == 0; } bool MemMap::Protect(int prot) { diff --git a/libartbase/base/mem_map_test.cc b/libartbase/base/mem_map_test.cc index 4a78bdcabe..c575c7a31f 100644 --- a/libartbase/base/mem_map_test.cc +++ b/libartbase/base/mem_map_test.cc @@ -471,9 +471,8 @@ TEST_F(MemMapTest, MapAnonymousExactAddr32bitHighAddr) { // cannot allocate in the 2GB-4GB region. TEST_DISABLED_FOR_MIPS(); - // This test may not work under Valgrind. - // TODO: Valgrind is no longer supported, but Address Sanitizer is: - // check whether this test works with ASan. + // This test does not work under AddressSanitizer. + // Historical note: This test did not work under Valgrind either. TEST_DISABLED_FOR_MEMORY_TOOL(); CommonInit(); |