Title: [198539] tags/Safari-602.1.25/Source/WebKit2

Diff

Modified: tags/Safari-602.1.25/Source/WebKit2/ChangeLog (198538 => 198539)


--- tags/Safari-602.1.25/Source/WebKit2/ChangeLog	2016-03-22 18:03:59 UTC (rev 198538)
+++ tags/Safari-602.1.25/Source/WebKit2/ChangeLog	2016-03-22 18:08:38 UTC (rev 198539)
@@ -1,3 +1,7 @@
+2016-03-22  Babak Shafiei  <[email protected]>
+
+        Roll out r198352.
+
 2016-03-22  Alberto Garcia  <[email protected]>
 
         Unreviewed typo fixes.

Copied: tags/Safari-602.1.25/Source/WebKit2/Platform/spi/Cocoa/DyldSPI.h (from rev 198351, trunk/Source/WebKit2/Platform/spi/Cocoa/DyldSPI.h) (0 => 198539)


--- tags/Safari-602.1.25/Source/WebKit2/Platform/spi/Cocoa/DyldSPI.h	                        (rev 0)
+++ tags/Safari-602.1.25/Source/WebKit2/Platform/spi/Cocoa/DyldSPI.h	2016-03-22 18:08:38 UTC (rev 198539)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <mach-o/dyld_priv.h>
+
+#else
+
+#import <mach-o/dyld_images.h>
+#import <stdint.h>
+
+enum dyld_image_states {
+    dyld_image_state_bound = 40,
+};
+
+typedef const char* (*dyld_image_state_change_handler)(enum dyld_image_states state, uint32_t infoCount, const struct dyld_image_info info[]);
+
+extern "C" void dyld_register_image_state_change_handler(enum dyld_image_states state, bool batch, dyld_image_state_change_handler handler);
+
+#endif

Modified: tags/Safari-602.1.25/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (198538 => 198539)


--- tags/Safari-602.1.25/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2016-03-22 18:03:59 UTC (rev 198538)
+++ tags/Safari-602.1.25/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm	2016-03-22 18:08:38 UTC (rev 198539)
@@ -30,6 +30,7 @@
 #if ENABLE(NETSCAPE_PLUGIN_API)
 
 #import "ArgumentCoders.h"
+#import "DyldSPI.h"
 #import "NetscapePlugin.h"
 #import "PluginProcessCreationParameters.h"
 #import "PluginProcessProxyMessages.h"
@@ -41,7 +42,6 @@
 #import <WebCore/LocalizedStrings.h>
 #import <WebKitSystemInterface.h>
 #import <dlfcn.h>
-#import <mach-o/dyld.h>
 #import <mach-o/getsect.h>
 #import <mach/mach_vm.h>
 #import <mach/vm_statistics.h>
@@ -490,38 +490,38 @@
         // Silverlight expects the data segment of its coreclr library to be executable.
         // Register with dyld to get notified when libraries are bound, then look for the
         // coreclr image and make its __DATA segment executable.
-        _dyld_register_func_for_add_image([](const struct mach_header* mh, intptr_t vmaddr_slide) {
-            Dl_info imageInfo;
-            if (!dladdr(mh, &imageInfo))
-                return;
+        dyld_register_image_state_change_handler(dyld_image_state_bound, false, [](enum dyld_image_states state, uint32_t infoCount, const struct dyld_image_info info[]) -> const char* {
+            for (uint32_t i = 0; i < infoCount; ++i) {
+                const char* pathSuffix = "/Silverlight.plugin/Contents/MacOS/CoreCLR.bundle/Contents/MacOS/coreclr";
 
-            const char* pathSuffix = "/Silverlight.plugin/Contents/MacOS/CoreCLR.bundle/Contents/MacOS/coreclr";
+                int pathSuffixLength = strlen(pathSuffix);
+                int imageFilePathLength = strlen(info[i].imageFilePath);
 
-            int pathSuffixLength = strlen(pathSuffix);
-            int imageFilePathLength = strlen(imageInfo.dli_fname);
+                if (imageFilePathLength < pathSuffixLength)
+                    continue;
 
-            if (imageFilePathLength < pathSuffixLength)
-                return;
+                if (strcmp(info[i].imageFilePath + (imageFilePathLength - pathSuffixLength), pathSuffix))
+                    continue;
 
-            if (strcmp(imageInfo.dli_fname + (imageFilePathLength - pathSuffixLength), pathSuffix))
-                return;
+                unsigned long segmentSize;
+                const uint8_t* segmentData = getsegmentdata(info[i].imageLoadAddress, "__DATA", &segmentSize);
+                if (!segmentData)
+                    break;
 
-            unsigned long segmentSize;
-            const uint8_t* segmentData = getsegmentdata(mh, "__DATA", &segmentSize);
-            if (!segmentData)
-                return;
+                mach_vm_size_t size;
+                uint32_t depth = 0;
+                struct vm_region_submap_info_64 info = { };
+                mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
+                for (mach_vm_address_t addr = reinterpret_cast<mach_vm_address_t>(segmentData); addr < reinterpret_cast<mach_vm_address_t>(segmentData) + segmentSize ; addr += size) {
+                    kern_return_t kr = mach_vm_region_recurse(mach_task_self(), &addr, &size, &depth, (vm_region_recurse_info_64_t)&info, &count);
+                    if (kr != KERN_SUCCESS)
+                        break;
 
-            mach_vm_size_t size;
-            uint32_t depth = 0;
-            struct vm_region_submap_info_64 info = { };
-            mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
-            for (mach_vm_address_t addr = reinterpret_cast<mach_vm_address_t>(segmentData); addr < reinterpret_cast<mach_vm_address_t>(segmentData) + segmentSize ; addr += size) {
-                kern_return_t kr = mach_vm_region_recurse(mach_task_self(), &addr, &size, &depth, (vm_region_recurse_info_64_t)&info, &count);
-                if (kr != KERN_SUCCESS)
-                    break;
+                    mach_vm_protect(mach_task_self(), addr, size, false, info.protection | VM_PROT_EXECUTE);
+                }
+            }
 
-                mach_vm_protect(mach_task_self(), addr, size, false, info.protection | VM_PROT_EXECUTE);
-            }
+            return nullptr;
         });
     }
 #endif

Modified: tags/Safari-602.1.25/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (198538 => 198539)


--- tags/Safari-602.1.25/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-03-22 18:03:59 UTC (rev 198538)
+++ tags/Safari-602.1.25/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-03-22 18:08:38 UTC (rev 198539)
@@ -202,6 +202,7 @@
 		1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */; };
 		1A2D956F12848564001EB962 /* ChildProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D956D12848564001EB962 /* ChildProcess.h */; };
 		1A2D957012848564001EB962 /* ChildProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D956E12848564001EB962 /* ChildProcess.cpp */; };
+		1A2E17EF1C6A590C00D04CF6 /* DyldSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2E17EE1C6A590C00D04CF6 /* DyldSPI.h */; };
 		1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; };
 		1A30EAC6115D7DA30053E937 /* ConnectionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.mm */; };
 		1A334DED16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A334DEB16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp */; };
@@ -2130,6 +2131,7 @@
 		1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProxyMac.mm; sourceTree = "<group>"; };
 		1A2D956D12848564001EB962 /* ChildProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcess.h; sourceTree = "<group>"; };
 		1A2D956E12848564001EB962 /* ChildProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildProcess.cpp; sourceTree = "<group>"; };
+		1A2E17EE1C6A590C00D04CF6 /* DyldSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DyldSPI.h; sourceTree = "<group>"; };
 		1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = "<group>"; };
 		1A30EAC5115D7DA30053E937 /* ConnectionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ConnectionMac.mm; sourceTree = "<group>"; };
 		1A334DEA16DE8B68006A8E38 /* StorageAreaMap.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = StorageAreaMap.messages.in; sourceTree = "<group>"; };
@@ -4945,6 +4947,7 @@
 			isa = PBXGroup;
 			children = (
 				1A5705101BE410E500874AF1 /* BlockSPI.h */,
+				1A2E17EE1C6A590C00D04CF6 /* DyldSPI.h */,
 				3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */,
 			);
 			path = Cocoa;
@@ -7708,6 +7711,7 @@
 				51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */,
 				7C361D731927FA360036A59D /* WebScriptMessageHandler.h in Headers */,
 				D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */,
+				1A2E17EF1C6A590C00D04CF6 /* DyldSPI.h in Headers */,
 				1A4832D71A9CDF96008B4DFE /* WebsiteData.h in Headers */,
 				1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */,
 				1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to