Address sanitizer on L version, we meet some problem as blow, maybe we miss some useful information for this feature, could you please show us the useful user guide for L ASan?
For 32bit process enable Address sanitizer, Android L 5.0 address sanitizer can't work, for L 5.1 java process enable ASan can work after disable many inceptor functions,below is part of com.android.browser maps.
00040000-03000000 ---p 00000000 00:00 0
03000000-18000000 rw-p 00000000 00:00 0
18941000-275f0000 rw-s 00000000 00:04 19513 /dev/ashmem/DiscardableMemoryAshmemAllocator (deleted)
b6ab6000-b6ae7000 r-xp 00000000 b3:11 1231 /system/lib/libclang_rt.asan_arm_android.so
b6ae7000-b6ae8000 r--p 00030000 b3:11 1231 /system/lib/libclang_rt.asan_arm_android.so
b6ae8000-b6ae9000 rw-p 00031000 b3:11 1231 /system/lib/libclang_rt.asan_arm_android.so
b6f6b000-b6f70000 r-xp 00000000 b3:11 226 /system/bin/asan/app_process
b6f70000-b6f71000 r--p 00004000 b3:11 226 /system/bin/asan/app_process
b6f71000-b6f72000 rw-p 00005000 b3:11 226 /system/bin/asan/app_process
Google issue about address sanitizer: https://code.google.com/p/address-sanitizer/issues/detail?id=326
main problem:
1. Conflict with libsigchain on Android 5.0, which also intercepts sigaction; On Android L 5.1, libsigchain.so no LD_PRELOAD
2. Missing libcorkscrew.so. We need a different way to unwind from a signal handler
For this problem, we have porting corkscrew unwind lib for providing related backtrace API
3. many intercept function SIGSEGV, strcmp/memchr etc
we also find information which show ASan can't work on L version.
https://code.google.com/p/address-sanitizer/wiki/Android
NOTE: ASan is broken on Android L. Use a K* build. This will be fixed in one of the future L updates.
For 64bit process, compiler is GCC 4.9, GCC 4.9 manual show it support address sanitizer but when set -fsanitize=address, no instrument for load/store.
gcc 4.9.2 user guide: -fsanitize=address
Enable AddressSanitizer, a fast memory error detector. Memory access instructions will be instrumented to detect out-of-bounds and use-after-free bugs. See http://code.google.com/p/address-sanitizer/ for more details. The run-time behavior can be influenced using the ASAN_OPTIONS environment variable; see https://code.google.com/p/address-sanitizer/wiki/Flags# Run-time_flags for a list of supported options
On Sat, Apr 11, 2015 at 12:31 AM, chunhuili chunhuili
<chunhui...@gmail.com> wrote:
> Hi Evgeniy,
>
> arm 32bit platform ASan can work as above description "L 5.1 java process
> enable ASan can work after disable many inceptor functions",
Do you mean the messages about failing to setup interceptors for ~15
functions that pop up on every process start, or did you need to do
something extra to make it work? The former is expected.
> I build with
> Android build system not NDK. But aarch64 bit can't wok
Yes, aarch64 runtime is not packaged in the NDK. You can build it from
compiler-rt source, and I recall it mostly works, with a few tests
failing, but the core functionality is there.