diff options
author | Colin Cross <ccross@android.com> | 2016-04-26 17:10:04 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-04-29 15:14:06 -0700 |
commit | 583a25083020802541d90ceb892a8c36bf1f49a0 (patch) | |
tree | 724b870f48b3ad22b2479a22e804379334d73a33 /libmemunreachable | |
parent | 0965c0247bff0ed97dc1c67d129d19fe4707c623 (diff) | |
download | system_core-583a25083020802541d90ceb892a8c36bf1f49a0.tar.gz system_core-583a25083020802541d90ceb892a8c36bf1f49a0.tar.bz2 system_core-583a25083020802541d90ceb892a8c36bf1f49a0.zip |
Silently ignore duplicate heap entries
Vendor blobs on ryu mprotect heap pages, causing a single chunk mapping
to appear as multiple mappings. The heap iterator has to expand the
requested range to cover the beginning of the chunk to find the chunk
metadata, which will lead to duplicate identical allocations being
reported from iterating over each of the split mappings. Silently
ignore identical allocations, and only warn on non-identical allocations
that overlap.
Bug: 28269332
Change-Id: Ied2ab9270f65d00a887c7ce1a93fbf0617d69be0
(cherry picked from commit cecd64012db013331ff1071254ab543dcdf327bd)
Diffstat (limited to 'libmemunreachable')
-rw-r--r-- | libmemunreachable/HeapWalker.cpp | 12 | ||||
-rw-r--r-- | libmemunreachable/HeapWalker.h | 6 |
2 files changed, 13 insertions, 5 deletions
diff --git a/libmemunreachable/HeapWalker.cpp b/libmemunreachable/HeapWalker.cpp index faa6fe2b2..62366f2ef 100644 --- a/libmemunreachable/HeapWalker.cpp +++ b/libmemunreachable/HeapWalker.cpp @@ -41,11 +41,13 @@ bool HeapWalker::Allocation(uintptr_t begin, uintptr_t end) { return true; } else { Range overlap = inserted.first->first; - ALOGE("range %p-%p overlaps with existing range %p-%p", - reinterpret_cast<void*>(begin), - reinterpret_cast<void*>(end), - reinterpret_cast<void*>(overlap.begin), - reinterpret_cast<void*>(overlap.end)); + if (overlap != range) { + ALOGE("range %p-%p overlaps with existing range %p-%p", + reinterpret_cast<void*>(begin), + reinterpret_cast<void*>(end), + reinterpret_cast<void*>(overlap.begin), + reinterpret_cast<void*>(overlap.end)); + } return false; } } diff --git a/libmemunreachable/HeapWalker.h b/libmemunreachable/HeapWalker.h index 140f3eaa0..3c1b513c1 100644 --- a/libmemunreachable/HeapWalker.h +++ b/libmemunreachable/HeapWalker.h @@ -31,6 +31,12 @@ struct Range { uintptr_t end; size_t size() const { return end - begin; }; + bool operator==(const Range& other) const { + return this->begin == other.begin && this->end == other.end; + } + bool operator!=(const Range& other) const { + return !(*this == other); + } }; // Comparator for Ranges that returns equivalence for overlapping ranges |