Title: [87308] trunk/Source/_javascript_Core
Revision
87308
Author
[email protected]
Date
2011-05-25 11:48:25 -0700 (Wed, 25 May 2011)

Log Message

2011-05-25  Oliver Hunt  <[email protected]>

        Reviewed by Geoffrey Garen.

        Make allocations with guard pages ensure that the allocation succeeded
        https://bugs.webkit.org/show_bug.cgi?id=61453

        Add null checks, and make PageBlock's operator bool() use
        the realbase, rather than the start of usable memory.

        * wtf/OSAllocatorPosix.cpp:
        (WTF::OSAllocator::reserveAndCommit):
        * wtf/PageBlock.h:
        (WTF::PageBlock::operator bool):
        (WTF::PageBlock::PageBlock):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (87307 => 87308)


--- trunk/Source/_javascript_Core/ChangeLog	2011-05-25 18:45:56 UTC (rev 87307)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-05-25 18:48:25 UTC (rev 87308)
@@ -1,3 +1,19 @@
+2011-05-25  Oliver Hunt  <[email protected]>
+
+        Reviewed by Geoffrey Garen.
+
+        Make allocations with guard pages ensure that the allocation succeeded
+        https://bugs.webkit.org/show_bug.cgi?id=61453
+
+        Add null checks, and make PageBlock's operator bool() use
+        the realbase, rather than the start of usable memory.
+
+        * wtf/OSAllocatorPosix.cpp:
+        (WTF::OSAllocator::reserveAndCommit):
+        * wtf/PageBlock.h:
+        (WTF::PageBlock::operator bool):
+        (WTF::PageBlock::PageBlock):
+
 2011-04-10  Kevin Ollivier  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp (87307 => 87308)


--- trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp	2011-05-25 18:45:56 UTC (rev 87307)
+++ trunk/Source/_javascript_Core/wtf/OSAllocatorPosix.cpp	2011-05-25 18:48:25 UTC (rev 87308)
@@ -95,9 +95,15 @@
 #endif
 
     result = mmap(result, bytes, protection, flags, fd, 0);
-    if (result == MAP_FAILED)
-        CRASH();
-    if (includesGuardPages) {
+    if (result == MAP_FAILED) {
+    #if ENABLE(INTERPRETER)
+        if (executable)
+            result = 0;
+        else
+    #endif
+            CRASH();
+    }
+    if (result && includesGuardPages) {
         mprotect(result, pageSize(), PROT_NONE);
         mprotect(static_cast<char*>(result) + bytes - pageSize(), pageSize(), PROT_NONE);
     }

Modified: trunk/Source/_javascript_Core/wtf/PageBlock.h (87307 => 87308)


--- trunk/Source/_javascript_Core/wtf/PageBlock.h	2011-05-25 18:45:56 UTC (rev 87307)
+++ trunk/Source/_javascript_Core/wtf/PageBlock.h	2011-05-25 18:48:25 UTC (rev 87308)
@@ -42,7 +42,7 @@
     void* base() const { return m_base; }
     size_t size() const { return m_size; }
 
-    operator bool() const { return !!m_base; }
+    operator bool() const { return !!m_realBase; }
 
     bool contains(void* containedBase, size_t containedSize)
     {
@@ -72,7 +72,7 @@
 
 inline PageBlock::PageBlock(void* base, size_t size, bool hasGuardPages)
     : m_realBase(base)
-    , m_base(static_cast<char*>(base) + (hasGuardPages ? pageSize() : 0))
+    , m_base(static_cast<char*>(base) + ((base && hasGuardPages) ? pageSize() : 0))
     , m_size(size)
 {
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to