Bug 1585712 - Use AutoEnterOOMUnsafeRegion instead of MOZ_CRASH in ExecutableAllocator::reprotectPool. r=jonco
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 05 Oct 2019 07:47:56 +0000
changeset 496494 937f71d963aea2784fd7265fa0b05d8eb3ddb2b5
parent 496493 a69d0ed7e27cc91839844fdf49f16185ab906941
child 496495 7e6a7b2f9fc65dbdebca4465dec03d42af83d9e1
push id36660
push userrgurzau@mozilla.com
push dateMon, 07 Oct 2019 16:27:18 +0000
treeherdermozilla-central@8208dff5da97 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1585712
milestone71.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 1585712 - Use AutoEnterOOMUnsafeRegion instead of MOZ_CRASH in ExecutableAllocator::reprotectPool. r=jonco mprotect is fallible and this makes it easier for fuzzers to deal with. Differential Revision: https://phabricator.services.mozilla.com/D48175
js/src/jit/ExecutableAllocator.cpp
--- a/js/src/jit/ExecutableAllocator.cpp
+++ b/js/src/jit/ExecutableAllocator.cpp
@@ -256,19 +256,20 @@ void ExecutableAllocator::addSizeOfCode(
   }
 }
 
 /* static */
 void ExecutableAllocator::reprotectPool(JSRuntime* rt, ExecutablePool* pool,
                                         ProtectionSetting protection,
                                         MustFlushICache flushICache) {
   char* start = pool->m_allocation.pages;
+  AutoEnterOOMUnsafeRegion oomUnsafe;
   if (!ReprotectRegion(start, pool->m_freePtr - start, protection,
                        flushICache)) {
-    MOZ_CRASH();
+    oomUnsafe.crash("ExecutableAllocator::reprotectPool");
   }
 }
 
 /* static */
 void ExecutableAllocator::poisonCode(JSRuntime* rt,
                                      JitPoisonRangeVector& ranges) {
   MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));