2011-02-13 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Feb 2011 21:39:03 +0000 (21:39 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Feb 2011 21:39:03 +0000 (21:39 +0000)
        Reviewed by Dan Bernstein.

        The plug-in process heap should be executable by default
        https://bugs.webkit.org/show_bug.cgi?id=54364
        <rdar://problem/8990563>

        * UIProcess/Launcher/ProcessLauncher.h:
        Add executableHeap flag.

        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
        (WebKit::ProcessLauncher::launchProcess):
        Set the right posix_spawn flag if executableHeap is true.

        * UIProcess/Plugins/PluginProcessProxy.cpp:
        (WebKit::PluginProcessProxy::PluginProcessProxy):
        Initialize executableHeap to true.

        * UIProcess/WebProcessProxy.cpp:
        (WebKit::WebProcessProxy::connect):
        Initialize executableHeap to false.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@78441 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h
Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.cpp

index bca889b..b8a896b 100644 (file)
@@ -1,5 +1,28 @@
 2011-02-13  Anders Carlsson  <andersca@apple.com>
 
 2011-02-13  Anders Carlsson  <andersca@apple.com>
 
+        Reviewed by Dan Bernstein.
+
+        The plug-in process heap should be executable by default
+        https://bugs.webkit.org/show_bug.cgi?id=54364
+        <rdar://problem/8990563>
+
+        * UIProcess/Launcher/ProcessLauncher.h:
+        Add executableHeap flag.
+        
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::ProcessLauncher::launchProcess):
+        Set the right posix_spawn flag if executableHeap is true.
+
+        * UIProcess/Plugins/PluginProcessProxy.cpp:
+        (WebKit::PluginProcessProxy::PluginProcessProxy):
+        Initialize executableHeap to true.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::connect):
+        Initialize executableHeap to false.
+
+2011-02-13  Anders Carlsson  <andersca@apple.com>
+
         Reviewed by Sam Weinig.
 
         Messages waited on are never dispatched
         Reviewed by Sam Weinig.
 
         Messages waited on are never dispatched
index 79d1253..8a1cd01 100644 (file)
@@ -56,6 +56,7 @@ public:
 #if PLATFORM(MAC)
         static const cpu_type_t MatchCurrentArchitecture = 0;
         cpu_type_t architecture;
 #if PLATFORM(MAC)
         static const cpu_type_t MatchCurrentArchitecture = 0;
         cpu_type_t architecture;
+        bool executableHeap;
 #endif
     };
 
 #endif
     };
 
index e8a5e76..92f5ad3 100644 (file)
@@ -231,6 +231,12 @@ void ProcessLauncher::launchProcess()
     // Start suspended so we can set up the termination notification handler.
     flags |= POSIX_SPAWN_START_SUSPENDED;
 
     // Start suspended so we can set up the termination notification handler.
     flags |= POSIX_SPAWN_START_SUSPENDED;
 
+#ifndef BUILDING_ON_SNOW_LEOPARD
+    static const int allowExecutableHeapFlag = 0x2000;
+    if (m_launchOptions.executableHeap)
+        flags |= allowExecutableHeapFlag;
+#endif
+
     posix_spawnattr_setflags(&attr, flags);
 
     pid_t processIdentifier;
     posix_spawnattr_setflags(&attr, flags);
 
     pid_t processIdentifier;
index 12a82b2..4b3b3c0 100644 (file)
@@ -52,6 +52,9 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage
     launchOptions.processType = ProcessLauncher::PluginProcess;
 #if PLATFORM(MAC)
     launchOptions.architecture = pluginInfo.pluginArchitecture;
     launchOptions.processType = ProcessLauncher::PluginProcess;
 #if PLATFORM(MAC)
     launchOptions.architecture = pluginInfo.pluginArchitecture;
+
+    // FIXME: This shouldn't be true for all plug-ins.
+    launchOptions.executableHeap = true;
 #endif
 
     m_processLauncher = ProcessLauncher::create(this, launchOptions);
 #endif
 
     m_processLauncher = ProcessLauncher::create(this, launchOptions);
index fd18e12..67dc46b 100644 (file)
@@ -101,9 +101,11 @@ void WebProcessProxy::connect()
 
         ProcessLauncher::LaunchOptions launchOptions;
         launchOptions.processType = ProcessLauncher::WebProcess;
 
         ProcessLauncher::LaunchOptions launchOptions;
         launchOptions.processType = ProcessLauncher::WebProcess;
+
 #if PLATFORM(MAC)
         // We want the web process to match the architecture of the UI process.
         launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture;
 #if PLATFORM(MAC)
         // We want the web process to match the architecture of the UI process.
         launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture;
+        launchOptions.executableHeap = false;
 #endif
         m_processLauncher = ProcessLauncher::create(this, launchOptions);
     }
 #endif
         m_processLauncher = ProcessLauncher::create(this, launchOptions);
     }