Changeset 86792 in webkit


Ignore:
Timestamp:
May 18, 2011 2:46:33 PM (13 years ago)
Author:
beidson@apple.com
Message:

<rdar://problem/9457633> and https://bugs.webkit.org/show_bug.cgi?id=61009
Processes spawned by SnowLeopard's WebProcess attempt to install WebKit2 shims.

Reviewed by Anders Carlsson.

If the WebProcess or PluginProcess forks, it shouldn't pass WebKit2 shims along to the new process
in the DYLD_INSERT_LIBRARIES environment variable.

Add Environment Utilities helper to strip unwanted values from an environment variable:

  • Platform/unix/EnvironmentUtilities.cpp: Added.

(WebKit::EnvironmentUtilities::stripValuesEndingWithString):

  • Platform/unix/EnvironmentUtilities.h: Added.
  • WebKit2.xcodeproj/project.pbxproj:

Strip PluginProcessShim.dylib from DYLD_INSERT_LIBRARIES:

  • PluginProcess/mac/PluginProcessMainMac.mm:

(WebKit::PluginProcessMain):

Strip WebProcessShim.dylib from DYLD_INSERT_LIBRARIES:

  • WebProcess/mac/WebProcessMainMac.mm:

(WebKit::WebProcessMain):

Unprotect SnowLeopard now that it will behave and not spawn processes trying to use WebKit2 shims:

  • UIProcess/Launcher/mac/ProcessLauncherMac.mm:

(WebKit::ProcessLauncher::launchProcess):

Location:
trunk/Source/WebKit2
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r86783 r86792  
     12011-05-18  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/9457633> and https://bugs.webkit.org/show_bug.cgi?id=61009
     6        Processes spawned by SnowLeopard's WebProcess attempt to install WebKit2 shims.
     7
     8        If the WebProcess or PluginProcess forks, it shouldn't pass WebKit2 shims along to the new process
     9        in the DYLD_INSERT_LIBRARIES environment variable.
     10
     11        Add Environment Utilities helper to strip unwanted values from an environment variable:
     12        * Platform/unix/EnvironmentUtilities.cpp: Added.
     13        (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
     14        * Platform/unix/EnvironmentUtilities.h: Added.
     15        * WebKit2.xcodeproj/project.pbxproj:
     16
     17        Strip PluginProcessShim.dylib from DYLD_INSERT_LIBRARIES:
     18        * PluginProcess/mac/PluginProcessMainMac.mm:
     19        (WebKit::PluginProcessMain):
     20
     21        Strip WebProcessShim.dylib from DYLD_INSERT_LIBRARIES:
     22        * WebProcess/mac/WebProcessMainMac.mm:
     23        (WebKit::WebProcessMain):
     24
     25        Unprotect SnowLeopard now that it will behave and not spawn processes trying to use WebKit2 shims:
     26        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
     27        (WebKit::ProcessLauncher::launchProcess):
     28
    1292011-05-18  Jon Lee  <jonlee@apple.com>
    230
  • trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm

    r86097 r86792  
    3030
    3131#import "CommandLine.h"
     32#import "EnvironmentUtilities.h"
    3233#import "NetscapePluginModule.h"
    3334#import "PluginProcess.h"
     
    5253int PluginProcessMain(const CommandLine& commandLine)
    5354{
    54     // Unset DYLD_INSERT_LIBRARIES. We don't want our plug-in process shim to be loaded
    55     // by any child processes that the plug-in may launch.
    56     unsetenv("DYLD_INSERT_LIBRARIES");
     55    // Remove the PluginProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes
     56    // spawned by the PluginProcess don't try to insert the shim and crash.
     57    EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/PluginProcessShim.dylib");
    5758
    5859    // Check if we're being spawned to write a MIME type preferences file.
  • trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm

    r86724 r86792  
    146146    if (m_launchOptions.processType == ProcessLauncher::PluginProcess)
    147147        processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"PluginProcessShim.dylib"];
    148 #ifndef BUILDING_ON_SNOW_LEOPARD
    149148    else if (m_launchOptions.processType == ProcessLauncher::WebProcess)
    150149        processShimPathNSString = [[processAppExecutablePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"WebProcessShim.dylib"];
    151 #endif
    152150   
    153151    // Make sure that the shim library file exists and insert it.
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r86692 r86792  
    363363                51ACBBA0127A8F2C00D203B9 /* WebContextMenuProxyMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */; };
    364364                51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */; };
     365                51B15A8413843A3900321AD8 /* EnvironmentUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */; };
     366                51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */; };
    365367                51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
    366368                51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
     
    12911293                51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxyMac.h; sourceTree = "<group>"; };
    12921294                51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuProxyMac.mm; sourceTree = "<group>"; };
     1295                51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EnvironmentUtilities.cpp; path = unix/EnvironmentUtilities.cpp; sourceTree = "<group>"; };
     1296                51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnvironmentUtilities.h; path = unix/EnvironmentUtilities.h; sourceTree = "<group>"; };
    12931297                51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; };
    12941298                51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
     
    24272431                        sourceTree = "<group>";
    24282432                };
     2433                51B15A7D138439B200321AD8 /* unix */ = {
     2434                        isa = PBXGroup;
     2435                        children = (
     2436                                51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */,
     2437                                51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */,
     2438                        );
     2439                        name = unix;
     2440                        sourceTree = "<group>";
     2441                };
    24292442                51B3004D12529CF5000B5CA0 /* cf */ = {
    24302443                        isa = PBXGroup;
     
    30183031                                1AB5A1BA10E021D30040F6CF /* CoreIPC */,
    30193032                                1A7E814E1152D2240003695B /* mac */,
     3033                                51B15A7D138439B200321AD8 /* unix */,
    30203034                                51A7F2F4125BF8D4008AEB1D /* Logging.cpp */,
    30213035                                51A7F2F2125BF820008AEB1D /* Logging.h */,
     
    37963810                                51D130541382EAC000351EDD /* SecItemRequestData.h in Headers */,
    37973811                                51D130561382EAC000351EDD /* SecItemResponseData.h in Headers */,
     3812                                51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */,
    37983813                        );
    37993814                        runOnlyForDeploymentPostprocessing = 0;
     
    44624477                                51D130551382EAC000351EDD /* SecItemResponseData.cpp in Sources */,
    44634478                                51D130581382F10500351EDD /* WebProcessProxyMac.mm in Sources */,
     4479                                51B15A8413843A3900321AD8 /* EnvironmentUtilities.cpp in Sources */,
    44644480                        );
    44654481                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebKit2/WebProcess/mac/WebProcessMainMac.mm

    r86734 r86792  
    2828
    2929#import "CommandLine.h"
     30#import "EnvironmentUtilities.h"
    3031#import "RunLoop.h"
    3132#import "WebProcess.h"
     
    4344#import <wtf/Threading.h>
    4445#import <wtf/text/CString.h>
     46#import <wtf/text/StringBuilder.h>
    4547
    4648// FIXME: We should be doing this another way.
     
    5961int WebProcessMain(const CommandLine& commandLine)
    6062{
     63#ifdef BUILDING_ON_SNOWLEOPARD
     64    // Remove the WebProcess shim from the DYLD_INSERT_LIBRARIES environment variable so any processes spawned by
     65    // the WebProcess don't try to insert the shim and crash.
     66    EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib");
     67#endif
     68
    6169    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    6270
     
    9199    RunLoop::initializeMainRunLoop();
    92100
    93 #ifndef BUILDING_ON_SNOW_LEOPARD
    94101    // Initialize the shim.
    95102    WebProcess::shared().initializeShim();
    96 #endif
    97103
    98104    // Create the connection.
Note: See TracChangeset for help on using the changeset viewer.