Bug 214346 - ASAN builds of WebKit should not freeze when an EXC_RESOURCE is delivered
Summary: ASAN builds of WebKit should not freeze when an EXC_RESOURCE is delivered
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: Other
Hardware: Unspecified macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-15 04:37 PDT by Tuomas Karkkainen
Modified: 2020-07-16 02:12 PDT (History)
2 users (show)

See Also:


Attachments
proposed patch (3.11 KB, patch)
2020-07-15 05:06 PDT, Tuomas Karkkainen
mark.lam: review+
mark.lam: commit-queue-
Details | Formatted Diff | Diff
proposed patch (3.13 KB, patch)
2020-07-16 01:22 PDT, Tuomas Karkkainen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tuomas Karkkainen 2020-07-15 04:37:14 PDT
When a process instrumented with AddressSanitizer receives an EXC_RESOURCE, it is frozen for several minutes.
Comment 1 Tuomas Karkkainen 2020-07-15 05:06:40 PDT
Created attachment 404332 [details]
proposed patch
Comment 2 Mark Lam 2020-07-15 07:37:17 PDT
Comment on attachment 404332 [details]
proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=404332&action=review

r=me with fix.

> Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:153
> +        // 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");
> +            }
> +        }

Can you guard this with #if ASAN_ENABLED?  We don't need this for any other builds, right?
Comment 3 Tuomas Karkkainen 2020-07-15 09:02:35 PDT
Ok, will do.

I was thinking other sanitizers might be affected, but looking quickly at an UBSAN build, there are no giant mappings there, so limiting it to ASAN makes sense.
Comment 4 Tuomas Karkkainen 2020-07-16 01:22:18 PDT
Created attachment 404429 [details]
proposed patch

wraps the code in #if ASAN_ENABLED as requested
Comment 5 EWS 2020-07-16 02:11:35 PDT
Committed r264450: <https://trac.webkit.org/changeset/264450>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 404429 [details].
Comment 6 Radar WebKit Bug Importer 2020-07-16 02:12:15 PDT
<rdar://problem/65653827>