Bug 1520783 - Don't assert if we fail to map a file after reserving the memory. r=sfink a=lizzard
authorEmanuel Hoogeveen <emanuel.hoogeveen@protonmail.com>
Thu, 31 Jan 2019 12:17:00 +0200
changeset 515780 161fa6ef84900cc5e34b2c3b247ae772250a0c91
parent 515779 0d2e173a01fdf528463e8c9d0b6c9844f13babcc
child 515781 f1bf2550b912d8f07c9c36cb5e64fd045405af41
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink, lizzard
bugs1520783
milestone66.0
Bug 1520783 - Don't assert if we fail to map a file after reserving the memory. r=sfink a=lizzard
js/src/gc/Memory.cpp
--- a/js/src/gc/Memory.cpp
+++ b/js/src/gc/Memory.cpp
@@ -865,17 +865,20 @@ void* AllocateMappedContent(int fd, size
     return nullptr;
   }
 
   // Calling mmap with MAP_FIXED will replace the previous mapping, allowing
   // us to reuse the region we obtained without racing with other threads.
   uint8_t* map =
       static_cast<uint8_t*>(mmap(region, alignedLength, PROT_READ | PROT_WRITE,
                                  MAP_PRIVATE | MAP_FIXED, fd, alignedOffset));
-  MOZ_RELEASE_ASSERT(map != MAP_FAILED);
+  if (map == MAP_FAILED) {
+    UnmapInternal(region, mappedLength);
+    return nullptr;
+  }
 #endif
 
 #ifdef DEBUG
   // Zero out data before and after the desired mapping to catch errors early.
   if (offset != alignedOffset) {
     memset(map, 0, offset - alignedOffset);
   }
   if (alignedLength % pageSize) {