From 08b09fb3ccbd78d0772d1095a0dc7150094e2c56 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Fri, 14 Jun 2013 14:03:25 +0200 Subject: [PATCH] Bug 882903 - SPS breadkpad unwinder segfaults with on-demand decompression on. r=glandium. --- mozglue/linker/ElfLoader.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mozglue/linker/ElfLoader.cpp b/mozglue/linker/ElfLoader.cpp index a9a6c6a125b..955eacb42dc 100644 --- a/mozglue/linker/ElfLoader.cpp +++ b/mozglue/linker/ElfLoader.cpp @@ -208,7 +208,14 @@ 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(mapped) + off); + } + } + return mapped; } void