Bug 882903 - SPS breadkpad unwinder segfaults with on-demand decompression on. r=glandium.
authorJulian Seward <jseward@acm.org>
Fri, 14 Jun 2013 14:03:25 +0200
changeset 146564 fbdcb79281aed2ea6f66795f4bfd7e8c229e1f5c
parent 146563 ce43d28276e494e9e3dba477cdcda931d15ffc7c
child 146565 3890895968afc5cfe57e08824fcb884fb29fff91
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs882903
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 882903 - SPS breadkpad unwinder segfaults with on-demand decompression on. r=glandium.
mozglue/linker/ElfLoader.cpp
--- a/mozglue/linker/ElfLoader.cpp
+++ b/mozglue/linker/ElfLoader.cpp
@@ -203,17 +203,24 @@ LibHandle::GetMappableLength() const
   return mappable->GetLength();
 }
 
 void *
 LibHandle::MappableMMap(void *addr, size_t length, off_t offset) const
 {
   MOZ_ASSERT(mappable == NULL, "MappableMMap must be called after"
                                " GetMappableLength");
-  return mappable->mmap(addr, length, PROT_READ, MAP_PRIVATE, offset);
+  void* mapped = mappable->mmap(addr, length, PROT_READ, MAP_PRIVATE, offset);
+  if (mapped != MAP_FAILED) {
+    /* Ensure the availability of all pages within the mapping */
+    for (size_t off = 0; off < length; off += PAGE_SIZE) {
+      mappable->ensure(reinterpret_cast<char *>(mapped) + off);
+    }
+  }
+  return mapped;
 }
 
 void
 LibHandle::MappableMUnmap(void *addr, size_t length) const
 {
   MOZ_ASSERT(mappable == NULL, "MappableMUnmap must be called after"
                                " MappableMMap and GetMappableLength");
   mappable->munmap(addr, length);