Changes between Version 5 and Version 6 of ASanWebKit

Jun 22, 2018 4:42:49 PM (4 years ago)

Remove pre-El-Cap instructions


  • ASanWebKit

    v5 v6  
    1616To disable ASan builds once again, use the --no-asan switch with set-webkit-configuration.
    18 == Building the Apple Mac OS X port with ASan (prior to Mac OS X 10.11 El Capitan) ==
    20 Building the Apple Mac OS X port with the clang Address Sanitizer currently requires a custom build of trunk clang, plus an Xcode toolchain derived from OSX10.9.xctoolchain.
    22 NOTE:  These instructions are currently an '''untested''' work-in-progress, but we hope to automate it with tools soon.
    24  1. Install Mac OS X 10.9.1 (Mavericks) on a Mac.  Don't use 10.9 as it contains a bug that causes a crash on every HTTP redirect.
    25  2. Install Xcode developer tools, including the Mac OS X 10.9 SDK.  These instructions assume the 10.9 SDK is located here:
    26 {{{
    27 /Applications/
    28 }}}
    29  With Xcode 6.1 on 10.9.5, the SDK is in:
    30  {{{
    31 /Applications/
    32 }}}
    33  3. Make a copy of the `OSX10.9.xctoolchain`(or `XcodeDefault.xctoolchain`) and call it `ASAN.xctoolchain`:
    34 {{{
    35 sudo ditto /Applications/ /Applications/
    36 }}}
    37  4. Edit `ASAN.xctoolchain/ToolchainInfo.plist` to change the `Identifier` string from `` to ``. (with Xcode 6.1 on 10.9.5, the `Identifier` is ``)
    38 {{{
    39 sudo vi /Applications/
    40 }}}
    41  5. Build trunk clang/llvm.  The address sanitizer should be built by default for Mac OS X.  See [ LLVM Docs] for details.  Subversion revision r204316 of clang/llvm is known to build WebKit for Mac OS X.  Newer versions may introduce new warnings or compiler bugs that must be fixed before proceeding. Alternatively, you can download a prebuilt binary from the [ Chromium Browser Clang] page.
    42  6. Ditto the clang/llvm build output into `/Applications/` to replace the version of clang/llvm in the original toolchain. If you downloaded a build from the [ Chromium Browser Clang] page, then it should be as simple as:
    43 {{{
    44 sudo ditto ~/Downloads/clang-218707/ /Applications/   
    45 }}}
    46  Replacing `~/Downloads/clang-218707/` with the location you extracted the clang archive to. Note that the trailing / on the path is important!
    47  7. Fix the ID of `libclang_rt.asan_osx_dynamic.dylib` to its installation path using the `install_name_tool`:
    48 {{{
    49 sudo xcrun install_name_tool -id /Applications/ /Applications/
    50 }}}
    51  You may have to change the `3.5.0` in the paths to match the version of clang you are using, especially if you download a build from the [ Chromium Browser Clang] page..
    52  8. Copy `libclang_rt.asan_osx_dynamic.dylib` into your `WebKitBuild/Release` directory:
    53 {{{
    54 ditto /Applications/ WebKitBuild/Release/
    55 }}}
    56  You may have to change the `3.5.0` in the paths to match the version of clang you are using, especially if you download a build from the [ Chromium Browser Clang] page.
    57  9. Build WebKit with additional xcodebuild arguments to load `asan.xcconfig`, find the ASan ignore list, and build with the new compiler:
    58 {{{
    59 make release ARGS="-xcconfig $PWD/Tools/asan/asan.xcconfig ASAN_IGNORE=$PWD/Tools/asan/webkit-asan-ignore.txt"
    60 }}}
    61  10. When running apps that load WebKit built with ASan, the `ASAN_OPTIONS` environment variable needs to be set to make sure the app crashes when you hit an issue, and to prevent false-positives for some intrinsics Mac OS X (e.g., memcpy and memmove are the same function).  For example, to launch Safari:
    62 {{{
    63 ASAN_OPTIONS="replace_intrin=0:abort_on_error=1:handle_segv=0" ./Tools/Scripts/run-safari --release --no-saved-state
    64 }}}
    65  You should also be able to run DumpRenderTree and WebKitTestRunner in a similar fashion:
    66 {{{
    67 ASAN_OPTIONS="replace_intrin=0:abort_on_error=1:handle_segv=0" ./Tools/Scripts/run-webkit-tests --release --no-build
    68 }}}
    69  11. Please use [ New WebKit Security Bug] link to file new bugs for crashes with ASan builds.