Changes between Version 5 and Version 6 of ASanWebKit


Ignore:
Timestamp:
Jun 22, 2018 4:42:49 PM (16 months ago)
Author:
mmaxfield@apple.com
Comment:

Remove pre-El-Cap instructions

Legend:

Unmodified
Added
Removed
Modified
  • ASanWebKit

    v5 v6  
    1515
    1616To disable ASan builds once again, use the --no-asan switch with set-webkit-configuration.
    17 
    18 == Building the Apple Mac OS X port with ASan (prior to Mac OS X 10.11 El Capitan) ==
    19 
    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.
    21 
    22 NOTE:  These instructions are currently an '''untested''' work-in-progress, but we hope to automate it with tools soon.
    23 
    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/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/
    28 }}}
    29  With Xcode 6.1 on 10.9.5, the SDK is in:
    30  {{{
    31 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/
    32 }}}
    33  3. Make a copy of the `OSX10.9.xctoolchain`(or `XcodeDefault.xctoolchain`) and call it `ASAN.xctoolchain`:
    34 {{{
    35 sudo ditto /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/ASAN.xctoolchain
    36 }}}
    37  4. Edit `ASAN.xctoolchain/ToolchainInfo.plist` to change the `Identifier` string from `com.apple.dt.toolchain.OSX10_9` to `com.apple.dt.toolchain.ASAN`. (with Xcode 6.1 on 10.9.5, the `Identifier` is `com.apple.dt.toolchain.XcodeDefault`)
    38 {{{
    39 sudo vi /Applications/Xcode.app/Contents/Developer/Toolchains/ASAN.xctoolchain/ToolchainInfo.plist
    40 }}}
    41  5. Build trunk clang/llvm.  The address sanitizer should be built by default for Mac OS X.  See [http://www.llvm.org/docs/ 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 [http://commondatastorage.googleapis.com/chromium-browser-clang/index.html?path=Mac/ Chromium Browser Clang] page.
    42  6. Ditto the clang/llvm build output into `/Applications/Xcode.app/Contents/Developer/Toolchains/ASAN.xctoolchain` to replace the version of clang/llvm in the original toolchain. If you downloaded a build from the [http://commondatastorage.googleapis.com/chromium-browser-clang/index.html?path=Mac/ Chromium Browser Clang] page, then it should be as simple as:
    43 {{{
    44 sudo ditto ~/Downloads/clang-218707/ /Applications/Xcode.app/Contents/Developer/Toolchains/ASAN.xctoolchain/usr/   
    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/Xcode.app/Contents/Developer/Toolchains/ASAN.xctoolchain/usr/lib/clang/3.5.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib /Applications/Xcode.app/Contents/Developer/Toolchains/ASAN.xctoolchain/usr/lib/clang/3.5.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
    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 [http://commondatastorage.googleapis.com/chromium-browser-clang/index.html?path=Mac/ Chromium Browser Clang] page..
    52  8. Copy `libclang_rt.asan_osx_dynamic.dylib` into your `WebKitBuild/Release` directory:
    53 {{{
    54 ditto /Applications/Xcode.app/Contents/Developer/Toolchains/ASAN.xctoolchain/usr/lib/clang/3.5.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib 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 [http://commondatastorage.googleapis.com/chromium-browser-clang/index.html?path=Mac/ 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 TOOLCHAINS=com.apple.dt.toolchain.ASAN"
    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 [https://bugs.webkit.org/enter_bug.cgi?product=Security New WebKit Security Bug] link to file new bugs for crashes with ASan builds.