Title: [93546] trunk/Source/WebKit2
Revision
93546
Author
msab...@apple.com
Date
2011-08-22 14:46:58 -0700 (Mon, 22 Aug 2011)

Log Message

REGRESSION (r92231): Apple campus proposal PDF doesn't display in Safari
https://bugs.webkit.org/show_bug.cgi?id=66464

Changed ArgumentEncoder to use system malloc instead of fastMalloc.
FastMalloc uses madvise(MADV_FREE_REUSABLE) which is incompatible with
mach message Out Of Line (OOL) messages that use MACH_MSG_VIRTUAL_COPY.
The system malloc has no such limitation.
Changed sendOutgoingMessage to use MACH_MSG_VIRTUAL_COPY again as it 
doesn't have size limitations that MACH_MSG_PHYSICAL_COPY.
        
Reviewed by Anders Carlsson.

* Platform/CoreIPC/ArgumentEncoder.cpp:
(CoreIPC::ArgumentEncoder::~ArgumentEncoder):
(CoreIPC::ArgumentEncoder::grow):
* Platform/CoreIPC/mac/ConnectionMac.cpp:
(CoreIPC::Connection::sendOutgoingMessage):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (93545 => 93546)


--- trunk/Source/WebKit2/ChangeLog	2011-08-22 21:45:39 UTC (rev 93545)
+++ trunk/Source/WebKit2/ChangeLog	2011-08-22 21:46:58 UTC (rev 93546)
@@ -1,3 +1,23 @@
+2011-08-21  Michael Saboff  <msab...@apple.com>
+
+        REGRESSION (r92231): Apple campus proposal PDF doesn't display in Safari
+        https://bugs.webkit.org/show_bug.cgi?id=66464
+
+        Changed ArgumentEncoder to use system malloc instead of fastMalloc.
+        FastMalloc uses madvise(MADV_FREE_REUSABLE) which is incompatible with
+        mach message Out Of Line (OOL) messages that use MACH_MSG_VIRTUAL_COPY.
+        The system malloc has no such limitation.
+        Changed sendOutgoingMessage to use MACH_MSG_VIRTUAL_COPY again as it 
+        doesn't have size limitations that MACH_MSG_PHYSICAL_COPY.
+        
+        Reviewed by Anders Carlsson.
+
+        * Platform/CoreIPC/ArgumentEncoder.cpp:
+        (CoreIPC::ArgumentEncoder::~ArgumentEncoder):
+        (CoreIPC::ArgumentEncoder::grow):
+        * Platform/CoreIPC/mac/ConnectionMac.cpp:
+        (CoreIPC::Connection::sendOutgoingMessage):
+
 2011-08-22  Anders Carlsson  <ander...@apple.com>
 
         Use -[NSApplication updateWindows] to update the current input context

Modified: trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp (93545 => 93546)


--- trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp	2011-08-22 21:45:39 UTC (rev 93545)
+++ trunk/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp	2011-08-22 21:46:58 UTC (rev 93546)
@@ -50,7 +50,7 @@
 ArgumentEncoder::~ArgumentEncoder()
 {
     if (m_buffer)
-        fastFree(m_buffer);
+        free(m_buffer);
 #if !USE(UNIX_DOMAIN_SOCKETS)
     // FIXME: We need to dispose of the attachments in cases of failure.
 #else
@@ -70,10 +70,13 @@
     
     if (alignedSize + size > m_bufferCapacity) {
         size_t newCapacity = std::max(alignedSize + size, std::max(static_cast<size_t>(32), m_bufferCapacity + m_bufferCapacity / 4 + 1));
+        // Use system malloc / realloc instead of fastMalloc due to 
+        // fastMalloc using MADV_FREE_REUSABLE doesn't work with
+        // mach messages with OOL message and MACH_MSG_VIRTUAL_COPY.
         if (!m_buffer)
-            m_buffer = static_cast<uint8_t*>(fastMalloc(newCapacity));
+            m_buffer = static_cast<uint8_t*>(malloc(newCapacity));
         else
-            m_buffer = static_cast<uint8_t*>(fastRealloc(m_buffer, newCapacity));
+            m_buffer = static_cast<uint8_t*>(realloc(m_buffer, newCapacity));
         
         // FIXME: What should we do if allocating memory fails?
 

Modified: trunk/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp (93545 => 93546)


--- trunk/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp	2011-08-22 21:45:39 UTC (rev 93545)
+++ trunk/Source/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp	2011-08-22 21:46:58 UTC (rev 93546)
@@ -155,7 +155,7 @@
     if (messageSize > sizeof(buffer)) {
         messageBodyIsOOL = true;
 
-        attachments.append(Attachment(arguments->buffer(), arguments->bufferSize(), MACH_MSG_PHYSICAL_COPY, false));
+        attachments.append(Attachment(arguments->buffer(), arguments->bufferSize(), MACH_MSG_VIRTUAL_COPY, false));
         numberOfOOLMemoryDescriptors++;
         messageSize = machMessageSize(0, numberOfPortDescriptors, numberOfOOLMemoryDescriptors);
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to