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