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.
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?
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.
Created attachment 217365 [details] Patch
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 ].
<rdar://problem/15506018>
Committed r160649: <http://trac.webkit.org/changeset/160649>