summaryrefslogtreecommitdiff
path: root/libartbase/base/mem_map.cc
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2018-06-14 13:55:49 +0100
committer Roland Levillain <rpl@google.com> 2018-06-14 16:50:31 +0100
commit0b0d3b421782fbe04085765df9e99fb05a93a01c (patch)
treecb894e3132f0e10f928bfd594d5ef3c46c6b7690 /libartbase/base/mem_map.cc
parent41a50f3627e4d84941aaf36d821ea8ba47750b56 (diff)
Re-enable ART code paths and tests for ASan that were disabled for Valgrind.
Test: SANITIZE_HOST=address ASAN_OPTIONS='detect_leaks=0' make test-art-host Bug: 29282211 Change-Id: I127a8c11c7d3b778c8d538aec0782a10f042225c
Diffstat (limited to 'libartbase/base/mem_map.cc')
-rw-r--r--libartbase/base/mem_map.cc20
1 files changed, 5 insertions, 15 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) {