Title: [197561] releases/WebKitGTK/webkit-2.4/Source/_javascript_Core
Revision
197561
Author
[email protected]
Date
2016-03-04 05:20:00 -0800 (Fri, 04 Mar 2016)

Log Message

Merge r193648 - Crashes on PPC64 due to mprotect() on address not aligned to the page size
https://bugs.webkit.org/show_bug.cgi?id=130237

Reviewed by Mark Lam.

Make sure that commitSize is at least as big as the page size.

* interpreter/JSStack.cpp:
(JSC::commitSize):
(JSC::JSStack::JSStack):
(JSC::JSStack::growSlowCase):
* interpreter/JSStack.h:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/ChangeLog (197560 => 197561)


--- releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/ChangeLog	2016-03-04 13:04:45 UTC (rev 197560)
+++ releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/ChangeLog	2016-03-04 13:20:00 UTC (rev 197561)
@@ -1,3 +1,18 @@
+2015-12-07  Alberto Garcia  <[email protected]>
+
+        Crashes on PPC64 due to mprotect() on address not aligned to the page size
+        https://bugs.webkit.org/show_bug.cgi?id=130237
+
+        Reviewed by Mark Lam.
+
+        Make sure that commitSize is at least as big as the page size.
+
+        * interpreter/JSStack.cpp:
+        (JSC::commitSize):
+        (JSC::JSStack::JSStack):
+        (JSC::JSStack::growSlowCase):
+        * interpreter/JSStack.h:
+
 2014-04-09  Mark Lam  <[email protected]>
 
         Ensure that LLINT accessing of the ProtoCallFrame is big endian friendly.

Modified: releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/interpreter/JSStack.cpp (197560 => 197561)


--- releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/interpreter/JSStack.cpp	2016-03-04 13:04:45 UTC (rev 197560)
+++ releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/interpreter/JSStack.cpp	2016-03-04 13:20:00 UTC (rev 197561)
@@ -42,6 +42,14 @@
     return staticMutex;
 }    
 
+static size_t commitSize()
+{
+    static size_t size = 0;
+    if (!size)
+        size = std::max(16 * 1024, getpagesize());
+    return size;
+}
+
 JSStack::JSStack(VM& vm, size_t capacity)
     : m_vm(vm)
     , m_end(0)
@@ -49,7 +57,7 @@
 {
     ASSERT(capacity && isPageAligned(capacity));
 
-    m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages);
+    m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize()), OSAllocator::JSVMStackPages);
     updateStackLimit(highAddress());
     m_commitEnd = highAddress();
 
@@ -78,7 +86,7 @@
     // Compute the chunk size of additional memory to commit, and see if we
     // have it is still within our budget. If not, we'll fail to grow and
     // return false.
-    long delta = roundUpAllocationSize(reinterpret_cast<char*>(m_commitEnd) - reinterpret_cast<char*>(newEnd), commitSize);
+    long delta = roundUpAllocationSize(reinterpret_cast<char*>(m_commitEnd) - reinterpret_cast<char*>(newEnd), commitSize());
     if (reinterpret_cast<char*>(m_commitEnd) - delta <= reinterpret_cast<char*>(m_useableEnd))
         return false;
 

Modified: releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/interpreter/JSStack.h (197560 => 197561)


--- releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/interpreter/JSStack.h	2016-03-04 13:04:45 UTC (rev 197560)
+++ releases/WebKitGTK/webkit-2.4/Source/_javascript_Core/interpreter/JSStack.h	2016-03-04 13:20:00 UTC (rev 197561)
@@ -73,7 +73,6 @@
         };
 
         static const size_t defaultCapacity = 512 * 1024;
-        static const size_t commitSize = 16 * 1024;
         // Allow 8k of excess registers before we start trying to reap the stack
         static const ptrdiff_t maxExcessCapacity = 8 * 1024;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to