Bug 124610 - [ASAN] WebKitLauncher: Include libasancrashreporter.dylib in DYLD_INSERT_LIBRARIES if it exists
Summary: [ASAN] WebKitLauncher: Include libasancrashreporter.dylib in DYLD_INSERT_LIBR...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.9
: P2 Enhancement
Assignee: David Farler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-11-19 15:11 PST by David Farler
Modified: 2013-12-16 10:14 PST (History)
2 users (show)

See Also:


Attachments
Patch (4.20 KB, patch)
2013-11-19 17:44 PST, David Farler
mrowe: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Farler 2013-11-19 15:11:38 PST
libasancrashreporter.dylib automatically attaches the Address Sanitizer’s output to the crash report by dynamically registering with compiler-rt’s __asan_set_error_report_callback. We should look for this library and also add it to DYLD_INSERT_LIBRARIES.
Comment 1 David Farler 2013-11-19 15:12:33 PST
I thought I might just set this in LSEnvironment and have the WebKitLauncher only append to DYLD_INSERT_LIBRARIES but it looks like it’s getting explicitly unset. Mark, do you know why that is? Should I just check to see if the dylib is in the bundle and add it to the list?
Comment 2 Mark Rowe (bdash) 2013-11-19 15:22:31 PST
Doing things via LSEnvironment isn't a good idea since it is not used when the binary is launched directly. If you're asking about the unsetenv("DYLD_INSERT_LIBRARIES"); call in WebKitNightlyEnabler.m, then that's to prevent the WebKitNightlyEnabler dylib from being injected in to all processes spawned by WebKit.app / Safari.app.
Comment 3 David Farler 2013-11-19 17:44:08 PST
Created attachment 217365 [details]
Patch
Comment 4 Mark Rowe (bdash) 2013-11-19 18:37:49 PST
Comment on attachment 217365 [details]
Patch

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

r=me assuming that the scenarios I mentioned work correctly.

> Tools/WebKitLauncher/WebKitNightlyEnabler.m:195
> +    if (pathToASanCrashReporterLib)
> +        setenv("DYLD_INSERT_LIBRARIES", [pathToASanCrashReporterLib UTF8String], 1);

This will result in the library being injected in to any subprocess launched by Safari. Back in the day that would include applications launched via LaunchServices calls that Safari happened to make (e.g., double-clicking on a file in the Downloads popover). It'd be worth confirming that this doesn't cause any problems.

Have you confirmed that this is sufficient to have the dylib be injected in to the XPC services that WebKit2 launches (e.g., both the web and network processes)?

> Tools/WebKitLauncher/main.m:245
> +        dyldInsertLibraries = [@[pathToASanCrashReporterLib, pathToEnablerLib] componentsJoinedByString:@":"];

Our style calls for spaces inside array literal: @[ foo, bar ].
Comment 5 David Kilzer (:ddkilzer) 2013-11-19 20:17:44 PST
<rdar://problem/15506018>
Comment 6 David Farler 2013-12-16 10:14:00 PST
Committed r160649: <http://trac.webkit.org/changeset/160649>