From 29acd2f2e2d5f953535be1f71bc89cbb3a00f52c Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Mon, 8 Sep 2014 22:41:35 -0700 Subject: [PATCH] Workaround Darwin ContainedWithinExistingMap issue Bug: 16861075 Change-Id: I577a0c7ede919e610c356e7c40dd60d87914dd3a --- runtime/mem_map.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc index 4d3f8c9a0..0615abddd 100644 --- a/runtime/mem_map.cc +++ b/runtime/mem_map.cc @@ -130,6 +130,7 @@ static uintptr_t GenerateNextMemPos() { uintptr_t MemMap::next_mem_pos_ = GenerateNextMemPos(); #endif +#if !defined(__APPLE__) // TODO: Reanable after b/16861075 BacktraceMap issue is addressed. // Return true if the address range is contained in a single /proc/self/map entry. static bool ContainedWithinExistingMap(uintptr_t begin, uintptr_t end, @@ -152,6 +153,7 @@ static bool ContainedWithinExistingMap(uintptr_t begin, begin, end, maps.c_str()); return false; } +#endif // Return true if the address range does not conflict with any /proc/self/maps entry. static bool CheckNonOverlapping(uintptr_t begin, @@ -386,8 +388,6 @@ MemMap* MemMap::MapFileAtAddress(byte* expected_ptr, size_t byte_count, int prot std::string* error_msg) { CHECK_NE(0, prot); CHECK_NE(0, flags & (MAP_SHARED | MAP_PRIVATE)); - uintptr_t expected = reinterpret_cast(expected_ptr); - uintptr_t limit = expected + byte_count; // Note that we do not allow MAP_FIXED unless reuse == true, i.e we // expect his mapping to be contained within an existing map. @@ -396,7 +396,11 @@ MemMap* MemMap::MapFileAtAddress(byte* expected_ptr, size_t byte_count, int prot // Only use this if you actually made the page reservation yourself. CHECK(expected_ptr != nullptr); +#if !defined(__APPLE__) // TODO: Reanable after b/16861075 BacktraceMap issue is addressed. + uintptr_t expected = reinterpret_cast(expected_ptr); + uintptr_t limit = expected + byte_count; DCHECK(ContainedWithinExistingMap(expected, limit, error_msg)); +#endif flags |= MAP_FIXED; } else { CHECK_EQ(0, flags & MAP_FIXED); -- 2.11.0