Re: How to build asan

352 views
Skip to first unread message

Stephen Hines

unread,
Jul 1, 2016, 2:08:53 AM7/1/16
to 盛震华, android-llvm
We don't provide binaries/builds that will work as drop-in replacements for older Android releases. The NDK ASan libraries can only be used to sanitize a single application, and only then on supported devices (https://github.com/google/sanitizers/wiki/AddressSanitizerOnAndroid has a list of the restrictions). For sanitizing the platform, you need to be building from source, but you also will need a compatible Clang toolchain (assuming you want to modify ASan). Earlier releases might have bugs exposed by newer Clang releases. It is also likely that there will be errors/warnings you will need to fix in those sources too. I am not sure how easy that is going to be.

Steve

On Thu, Jun 30, 2016 at 10:17 PM, 盛震华 <shengzhe...@gmail.com> wrote:
Dear Steve,
    Thank you for you reply.I have insteresting in building a AOSP system image with ASan enabled.And a simple way to build android application with asan.Now I change the aosp4.4 rom with libclang_rt.asan-arm-android.so in ndk.But it doesn't work in AOSP5.0 or 5.1.And it will stop when find a bug.I want to rewrite the source to make a fitter rom .
Best wishes.

2016-07-01 12:50 GMT+08:00 Stephen Hines <srh...@google.com>:
Are you interested in ASan on Android or just ASan in general?

The general LLVM upstream docs about using ASan are here:
http://clang.llvm.org/docs/AddressSanitizer.html
http://clang.llvm.org/docs/AddressSanitizer.html#how-to-build specifically says to just use upstream cmake, and I can recommend that method if you are just trying to use ASan on your desktop. This mailing list is also then not really appropriate, since we don't work on general ASan issues.

If you are interested in experimenting with ASan for application builds in Android, the following docs can be helpful:

For building an AOSP system image with ASan enabled, you can follow https://source.android.com/devices/tech/debug/asan.html#sanitize_target to create an image. I think this will probably only fit for Shamu in AOSP, although Angler support might work soon.

If you are trying to experiment with ASan in the Android toolchain, you will have to build it using the following instructions:

That describes how to build and use a new toolchain from the aosp/llvm branch. You can change compiler-rt's ASan implementation there and then deploy it in another aosp/master branch (although since aosp/llvm is our development branch, I can tell you that we are working through some x86-specific bugs right now before deploying a new/updated compiler).

Thanks,
Steve


On Thu, Jun 30, 2016 at 9:00 PM, <shengzhe...@gmail.com> wrote:
Dear All:
        I am a researher in China. I have instrested in asan program.I want to know how to get code of asan and how to build it by myself.

Best Wishes



Reply all
Reply to author
Forward
0 new messages