Title: [197821] trunk/Source/_javascript_Core
Revision
197821
Author
oli...@apple.com
Date
2016-03-08 17:05:53 -0800 (Tue, 08 Mar 2016)

Log Message

Fix ios bot build.

Modified Paths


Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (197820 => 197821)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-09 01:00:34 UTC (rev 197820)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-09 01:05:53 UTC (rev 197821)
@@ -1,3 +1,10 @@
+2016-03-08  Oliver Hunt  <oli...@apple.com>
+
+        Fix ios bot build.
+
+        * jit/ExecutableAllocatorFixedVMPool.cpp:
+        (JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps):
+
 2016-03-08  Mark Lam  <mark....@apple.com>
 
         Implement Function.name support for getters/setters and inferring name of function properties.

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp (197820 => 197821)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp	2016-03-09 01:00:34 UTC (rev 197820)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocatorFixedVMPool.cpp	2016-03-09 01:05:53 UTC (rev 197821)
@@ -54,7 +54,29 @@
 
 #if OS(DARWIN)
 #include <mach/mach.h>
-#include <mach/mach_vm.h>
+extern "C" {
+    /* Routine mach_vm_remap */
+#ifdef mig_external
+    mig_external
+#else
+    extern
+#endif /* mig_external */
+    kern_return_t mach_vm_remap
+    (
+     vm_map_t target_task,
+     mach_vm_address_t *target_address,
+     mach_vm_size_t size,
+     mach_vm_offset_t mask,
+     int flags,
+     vm_map_t src_task,
+     mach_vm_address_t src_address,
+     boolean_t copy,
+     vm_prot_t *cur_protection,
+     vm_prot_t *max_protection,
+     vm_inherit_t inheritance
+     );
+}
+
 #endif
 
 #endif
@@ -157,31 +179,33 @@
             mach_task_self(), (mach_vm_address_t)jitBase, FALSE,
             &cur, &max, VM_INHERIT_DEFAULT);
 
-        RELEASE_ASSERT(ret == KERN_SUCCESS);
+        bool remapSucceeded = (ret == KERN_SUCCESS);
+        if (!remapSucceeded)
+            writableAddr = (mach_vm_address_t)jitBase;
 
-
         // Assemble a thunk that will serve as the means for writing into the JIT region.
         MacroAssemblerCodeRef writeThunk = jitWriteThunkGenerator(writableAddr, stubBase, stubSize);
 
         int result = 0;
 
+        if (!remapSucceeded) {
 #if defined(VM_PROT_EXECUTE_ONLY)
-        // Prevent reading the write thunk code.
-        result = mprotect(stubBase, stubSize, VM_PROT_EXECUTE_ONLY);
-        RELEASE_ASSERT(!result);
+            // Prevent reading the write thunk code.
+            result = mprotect(stubBase, stubSize, VM_PROT_EXECUTE_ONLY);
+            RELEASE_ASSERT(!result);
 #endif
-        
-        // Prevent writing into the executable JIT mapping.
-        result = mprotect(jitBase, jitSize, VM_PROT_READ | VM_PROT_EXECUTE);
-        RELEASE_ASSERT(!result);
 
-        // Prevent execution in the writable JIT mapping.
-        result = mprotect((void*)writableAddr, jitSize, VM_PROT_READ | VM_PROT_WRITE);
-        RELEASE_ASSERT(!result);
+            // Prevent writing into the executable JIT mapping.
+            result = mprotect(jitBase, jitSize, VM_PROT_READ | VM_PROT_EXECUTE);
+            RELEASE_ASSERT(!result);
 
-        // Zero out writableAddr to avoid leaking the address of the writable mapping.
-        memset_s(&writableAddr, sizeof(writableAddr), 0, sizeof(writableAddr));
+            // Prevent execution in the writable JIT mapping.
+            result = mprotect((void*)writableAddr, jitSize, VM_PROT_READ | VM_PROT_WRITE);
+            RELEASE_ASSERT(!result);
 
+            // Zero out writableAddr to avoid leaking the address of the writable mapping.
+            memset_s(&writableAddr, sizeof(writableAddr), 0, sizeof(writableAddr));
+        }
         jitWriteFunctionAddress = (uintptr_t)writeThunk.code().executableAddress();
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to