Title: [264450] trunk/Source/WebKit
- Revision
- 264450
- Author
- [email protected]
- Date
- 2020-07-16 02:11:31 -0700 (Thu, 16 Jul 2020)
Log Message
ASAN builds of WebKit should not freeze when an EXC_RESOURCE is delivered
https://bugs.webkit.org/show_bug.cgi?id=214346
Patch by Tuomas Karkkainen <[email protected]> on 2020-07-16
Reviewed by Mark Lam.
When the WebContent process allocates 1000 MB of memory or starts 32
threads, it receives an EXC_RESOURCE. This requires iterating all the
mappings of the process. For the case of a process instrumented with
AddressSanitizer, the mappings total 20 terabytes, and cause the
process to "freeze" for several minutes.
Setting the sysctl debug.toggle_address_reuse to 1 causes the
EXC_RESOURCE mechanism to skip iteration of all the mappings.
With this patch, setting the environment variable
DISABLE_FREEZING_ON_EXC_RESOURCE will set the sysctl mentioned above
for WebContent and Networking processes.
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (264449 => 264450)
--- trunk/Source/WebKit/ChangeLog 2020-07-16 08:21:58 UTC (rev 264449)
+++ trunk/Source/WebKit/ChangeLog 2020-07-16 09:11:31 UTC (rev 264450)
@@ -1,3 +1,25 @@
+2020-07-16 Tuomas Karkkainen <[email protected]>
+
+ ASAN builds of WebKit should not freeze when an EXC_RESOURCE is delivered
+ https://bugs.webkit.org/show_bug.cgi?id=214346
+
+ Reviewed by Mark Lam.
+
+ When the WebContent process allocates 1000 MB of memory or starts 32
+ threads, it receives an EXC_RESOURCE. This requires iterating all the
+ mappings of the process. For the case of a process instrumented with
+ AddressSanitizer, the mappings total 20 terabytes, and cause the
+ process to "freeze" for several minutes.
+
+ Setting the sysctl debug.toggle_address_reuse to 1 causes the
+ EXC_RESOURCE mechanism to skip iteration of all the mappings.
+
+ With this patch, setting the environment variable
+ DISABLE_FREEZING_ON_EXC_RESOURCE will set the sysctl mentioned above
+ for WebContent and Networking processes.
+
+ * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
+
2020-07-15 Per Arne Vollan <[email protected]>
Unreviewed, revert part of r264385.
Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm (264449 => 264450)
--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm 2020-07-16 08:21:58 UTC (rev 264449)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm 2020-07-16 09:11:31 UTC (rev 264450)
@@ -30,6 +30,7 @@
#import <CoreFoundation/CoreFoundation.h>
#import <pal/spi/cf/CFUtilitiesSPI.h>
#import <pal/spi/cocoa/LaunchServicesSPI.h>
+#import <sys/sysctl.h>
#import <wtf/OSObjectPtr.h>
#import <wtf/RetainPtr.h>
#import <wtf/spi/darwin/XPCSPI.h>
@@ -139,6 +140,19 @@
if (bootstrap) {
#if PLATFORM(MAC)
+#if ASAN_ENABLED
+ // EXC_RESOURCE on ASAN builds freezes the process for several minutes: rdar://65027596
+ if (char *disableFreezingOnExcResource = getenv("DISABLE_FREEZING_ON_EXC_RESOURCE")) {
+ if (!strcasecmp(disableFreezingOnExcResource, "yes") || !strcasecmp(disableFreezingOnExcResource, "true") || !strcasecmp(disableFreezingOnExcResource, "1")) {
+ int val = 1;
+ int rc = sysctlbyname("debug.toggle_address_reuse", nullptr, 0, &val, sizeof(val));
+ if (rc < 0)
+ WTFLogAlways("failed to set debug.toggle_address_reuse: %d\n", rc);
+ else
+ WTFLogAlways("debug.toggle_address_reuse is now 1.\n");
+ }
+ }
+#endif
String webKitBundleVersion = xpc_dictionary_get_string(bootstrap.get(), "WebKitBundleVersion");
String expectedBundleVersion = [NSBundle bundleWithIdentifier:@"com.apple.WebKit"].infoDictionary[(__bridge NSString *)kCFBundleVersionKey];
if (!webKitBundleVersion.isNull() && !expectedBundleVersion.isNull() && webKitBundleVersion != expectedBundleVersion) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes