andmer / address-sanitizer

Automatically exported from code.google.com/p/address-sanitizer
0 stars 0 forks source link

AddressSanitizer: while reporting a bug found another one. Ignoring. #391

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Build *.so with Application.mk:
1. MEMORY_SANITIZE := true

APP_STL := c++_shared 
APP_CPPFLAGS := -frtti -fexceptions -std=c++14

APP_CFLAGS += -Qunused-arguments

ifeq ($(MEMORY_SANITIZE), true)
APP_OPTIM := debug
# https://code.google.com/p/address-sanitizer/wiki/Android
APP_CFLAGS   := -fsanitize=address -fno-omit-frame-pointer
APP_CFLAGS   += -O1 -g
APP_STL      := c++_shared 
APP_LDFLAGS  := -fsanitize=address
LIBCXX_FORCE_REBUILD := true
endif

APP_ABI := armeabi-v7a x86
APP_PLATFORM := android-14

NDK_TOOLCHAIN_VERSION=clang3.6

2. prepare device(with root) with asan script from NDK10e
3. if I switch to APP_STL := gnustl_shared all works
4. prepare minimal bug in code:
        int* ptr = new int[100]();
        ptr[101] = 0xF0F0F0F0;

        Logger::Info("just after memory corruption!!!!! %d", &ptr[101]);

if I use APP_STL := c++_shared I got:
06-05 16:46:52.046: I/(6946): 
=================================================================
06-05 16:46:52.056: I/(6946): ==6946==ERROR: AddressSanitizer: 
heap-buffer-overflow on address 0x43d0fbd4 at pc 0x6f22bf4c bp 0x70517a68 sp 
0x70517a60
06-05 16:46:52.056: I/(6946): WRITE of size 4 at 0x43d0fbd4 thread T618
06-05 16:46:52.056: I/(6946): ==6946==AddressSanitizer: while reporting a bug 
found another one. Ignoring.

Is any way to find out correct address to put it to addr2line?
I want use c++11 and c++14 with current last NDK10e so try use c++_shared with 
-fsanitize=address but output looks bad

thanks in advance

Original issue reported on code.google.com by leanid.c...@gmail.com on 5 Jun 2015 at 2:03

GoogleCodeExporter commented 9 years ago
Does it work if you add fast_unwind_on_fatal=1 to ASAN_OPTIONS? There are known 
issues with stack unwinder in libc++ (ex. 
https://code.google.com/p/chromium/issues/detail?id=490275).

Original comment by euge...@google.com on 5 Jun 2015 at 5:58

GoogleCodeExporter commented 9 years ago
Yes! with fast_unwind_on_fatal=1 it works!

Thank you

Original comment by leanid.c...@gmail.com on 8 Jun 2015 at 7:46

GoogleCodeExporter commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Original comment by ramosian.glider@gmail.com on 30 Jul 2015 at 9:06