Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add device llvm-symbolizer to NDK #753

Closed
eugenis opened this issue Jul 25, 2018 · 10 comments
Closed

Add device llvm-symbolizer to NDK #753

eugenis opened this issue Jul 25, 2018 · 10 comments

Comments

@eugenis
Copy link

eugenis commented Jul 25, 2018

The easiest way to get symbolized reports from ASan is with on-device llvm-symbolizer binary.
Currently, NDK provides only a host binary.
Both asan_device_setup and wrap.sh-based workflows can automate symbolization setup (with wrap.sh we would add llvm-symbolizer to the apk and set ASAN_OPTIONS or ASAN_SYMBOLIZER_PATH).

@DanAlbert
Copy link
Member

Is this still needed, or was the work done by this rolled into ndk-stack? @enh-google

@eugenis
Copy link
Author

eugenis commented Apr 15, 2020

It would provide slightly better user experience, because sanitizer reports would come out pre-symbolized. But ndk-stack is enough to get all the same info, just with extra steps.

@enh-google
Copy link
Collaborator

would Studio support that workflow? i thought dan said it's hard to get symbols onto the device because Studio (cmake?) doesn't believe in that?

@stephenhines
Copy link
Collaborator

@hhb is in the middle of refactoring our build and changing the process by which we build many of the device components now. Once that is converted over, we could build and package the extra device binaries for llvm-symbolizer. Then we would need the NDK to properly package these (similar to how the runtime libraries all come from the Linux build, but must be distributed for each host separately).

@DanAlbert
Copy link
Member

AGP will strip symbols for the APK by default, but you can override it with

packagingOptions {
    doNotStrip {
        "libs/*/libfoo.so"
    }
}

or something like that. It's not going to be the common case by any means.

I think I'll close this for now. If we get users asking for it we'll reopen, but I think in practice everyone will need ndk-stack anyway.

@bjacob
Copy link

bjacob commented Oct 30, 2020

I just found about this issue. I have a binary that definitely contains symbols and debug information, as tracy on it is able to show perfect stacks without being pointed to any additional symbols file/directory.

Now I'm running it with ASan, and getting ASan stacks on stderr like:

WRITE of size 8 at 0x0065720656c0 thread T0
    #0 0x5b09882ac4  (/data/local/tmp/iree-benchmark-module+0x1d7ac4)
    #1 0x5b09880f90  (/data/local/tmp/iree-benchmark-module+0x1d5f90)
    #2 0x5b09880724  (/data/local/tmp/iree-benchmark-module+0x1d5724)

I've tried feeding that to ndk-stack but it doesn't output anything. My guess is that it doesn't parse the format that ASan stacks are in, since ndk-stack docs suggest examples where the stack is as dumped on logcat, and that's a different format.

Reading closer the doc, I learned that I should try to put a logcat-like marker line like

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

Once I did this, ndk-build started printing this:

********** Crash dump: **********

But still nothing else.

So, it looks like ndk-stack is at most a satisfactory solution in contexts where stack traces are coming from a log in a particular format. It's not applicable to ASan use cases.

Finally, consider that even if all these issues with ndk-stack were addressed, it would still not be as convenient as outputting readily annotated stacks.

As stated at the beginning, Tracy is able to symbolize all these stacks, so if llvm-symbolizer is any trouble (which it seems to be, seeing how it seems to require being built from the same LLVM version as produced the program being symbolized), maybe just look at what Tracy is doing instead?

@stephenhines
Copy link
Collaborator

@bjacob llvm-symbolizer is in the latest NDK r22 beta 1. Can you give that a try to see if it solves your problem?

@enh-google
Copy link
Collaborator

ndk-stack should (despite the TODO) cope; @eugenis added support (see the __sanitizer_line_re line):

    # See unwindstack::FormatFrame in libunwindstack.
    # We're deliberately very loose because NDK users are likely to be
    # looking at crashes on ancient OS releases.
    # TODO: support asan stacks too?
    _line_re = re.compile(r'.* +(#[0-9]+) +pc ([0-9a-f]+) +(([^ ]+).*)')
    _sanitizer_line_re = re.compile(r'.* +(#[0-9]+) +0x[0-9a-f]* +\(([^ ]+)\+0x([0-9a-f]+)\)')
    _lib_re = re.compile(r'([^\!]+)\!(.+)')
    _offset_re = re.compile(r'\(offset\s+(0x[0-9a-f]+)\)')
    _build_id_re = re.compile(r'\(BuildId:\s+([0-9a-f]+)\)')

ah, but that was https://android-review.googlesource.com/c/platform/ndk/+/1225302 which will have been too late for r21. r22beta1 should have this though.

@bjacob
Copy link

bjacob commented Oct 30, 2020

@stephenhines :

@bjacob llvm-symbolizer is in the latest NDK r22 beta 1. Can you give that a try to see if it solves your problem?

I just downloaded NDK r22 beta 1 but still can't find any device build of llvm-symbolizer. Only the same host build as in r21:

$ find android-ndk-r22-beta1/ -name '*symbolizer'
android-ndk-r22-beta1/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-symbolizer

@enh-google

Thanks for the tip, retrying ndk-stack with r22 beta 1 now ...

@bjacob
Copy link

bjacob commented Oct 30, 2020

@enh-google I've tried ndk-stack from r22 beta 1 now. Issues:

  1. It still requires the input to start with *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***, which ASan output does not, so I still have to add that manually in a text editor every time.

  2. It still prepends the output with "Crash dump" which could get confusing in case of non-crash stack traces as from non-fatal sanitizer reports.

  3. It still takes a mandatory --sym parameter asking where "the .so files" are stored, which is confusing in case of native executables which may not involve .so's, and this still bakes in an assumption that all the binary code lives in a single directory. In practice, different stack frames may be in different files in different directories; even in my simple use case, I have

#17 0x7a798 /apex/com.android.runtime/lib64/bionic/libc.so

which ndk-stack is unable to symbolize because it's not in the directory that I passed in --sym.

  1. It drops input lines that aren't stack frames, so two-stack ASan reports look wrong - it outputs the two stacks back-to-back without any indication anymore of what each of these stacks is.

For reference:

Here is the raw output from ASan:

WRITE of size 8 at 0x0065720656c0 thread T0
    #0 0x5b09882ac4  (/data/local/tmp/iree-benchmark-module+0x1d7ac4)
    #1 0x5b09880f90  (/data/local/tmp/iree-benchmark-module+0x1d5f90)
    #2 0x5b09880724  (/data/local/tmp/iree-benchmark-module+0x1d5724)
    #3 0x5b09835a14  (/data/local/tmp/iree-benchmark-module+0x18aa14)
    #4 0x5b097d632c  (/data/local/tmp/iree-benchmark-module+0x12b32c)
    #5 0x5b09811cc4  (/data/local/tmp/iree-benchmark-module+0x166cc4)
    #6 0x5b0981d1b8  (/data/local/tmp/iree-benchmark-module+0x1721b8)
    #7 0x5b09872d08  (/data/local/tmp/iree-benchmark-module+0x1c7d08)
    #8 0x5b09871950  (/data/local/tmp/iree-benchmark-module+0x1c6950)
    #9 0x5b0986d5c8  (/data/local/tmp/iree-benchmark-module+0x1c25c8)
    #10 0x5b098780fc  (/data/local/tmp/iree-benchmark-module+0x1cd0fc)
    #11 0x5b09858bd8  (/data/local/tmp/iree-benchmark-module+0x1adbd8)
    #12 0x5b098581fc  (/data/local/tmp/iree-benchmark-module+0x1ad1fc)
    #13 0x5b09857558  (/data/local/tmp/iree-benchmark-module+0x1ac558)
    #14 0x5b097436b8  (/data/local/tmp/iree-benchmark-module+0x986b8)
    #15 0x5b09742304  (/data/local/tmp/iree-benchmark-module+0x97304)
    #16 0x7f72497798  (/apex/com.android.runtime/lib64/bionic/libc.so+0x7a798)

0x0065720656c0 is located 0 bytes to the right of 128-byte region [0x006572065640,0x0065720656c0)
allocated by thread T0 here:
    #0 0x7f7297cdb8  (/system/lib64/libclang_rt.asan-aarch64-android.so+0x9fdb8)
    #1 0x5b09a84f48  (/data/local/tmp/iree-benchmark-module+0x3d9f48)
    #2 0x5b09880ef8  (/data/local/tmp/iree-benchmark-module+0x1d5ef8)
    #3 0x5b09880724  (/data/local/tmp/iree-benchmark-module+0x1d5724)
    #4 0x5b09835a14  (/data/local/tmp/iree-benchmark-module+0x18aa14)
    #5 0x5b097d632c  (/data/local/tmp/iree-benchmark-module+0x12b32c)
    #6 0x5b09811cc4  (/data/local/tmp/iree-benchmark-module+0x166cc4)
    #7 0x5b0981d1b8  (/data/local/tmp/iree-benchmark-module+0x1721b8)
    #8 0x5b09872d08  (/data/local/tmp/iree-benchmark-module+0x1c7d08)
    #9 0x5b09871950  (/data/local/tmp/iree-benchmark-module+0x1c6950)
    #10 0x5b0986d5c8  (/data/local/tmp/iree-benchmark-module+0x1c25c8)
    #11 0x5b098780fc  (/data/local/tmp/iree-benchmark-module+0x1cd0fc)
    #12 0x5b09858bd8  (/data/local/tmp/iree-benchmark-module+0x1adbd8)
    #13 0x5b098581fc  (/data/local/tmp/iree-benchmark-module+0x1ad1fc)
    #14 0x5b09857558  (/data/local/tmp/iree-benchmark-module+0x1ac558)
    #15 0x5b097436b8  (/data/local/tmp/iree-benchmark-module+0x986b8)
    #16 0x5b09742304  (/data/local/tmp/iree-benchmark-module+0x97304)
    #17 0x7f72497798  (/apex/com.android.runtime/lib64/bionic/libc.so+0x7a798)
    #18 0x5b097402c8  (/data/local/tmp/iree-benchmark-module+0x952c8)
    #19 0x7f73ebd6e4  (/data/local/tmp/iree-benchmark-module+0x516e4)

Here is what ndk-stack shows:
... well, initially it shows nothing, but if I add the *** marker at the start of the input, I get:

cat ~/a | ~/android-ndk-r22-beta1/ndk-stack --sym ~/iree-build-android/iree/tools/
********** Crash dump: **********
#0 0x1d7ac4 /data/local/tmp/iree-benchmark-module
iree::hal::dylib::DyLibExecutable::Initialize(iree::hal::ExecutableSpec)
/usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable.cc:93:21
#1 0x1d5f90 /data/local/tmp/iree-benchmark-module
iree::hal::dylib::DyLibExecutable::Load(iree::hal::ExecutableSpec)
/usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable.cc:28:3
#2 0x1d5724 /data/local/tmp/iree-benchmark-module
iree::hal::dylib::DyLibExecutableCache::PrepareExecutable(iree::hal::ExecutableLayout*, iree::hal::ExecutableCachingMode, iree::hal::ExecutableSpec const&)
/usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable_cache.cc:46:10
#3 0x18aa14 /data/local/tmp/iree-benchmark-module
iree_hal_executable_cache_prepare_executable
/usr/local/google/home/benoitjacob/iree/iree/hal/api.cc:1970:3
#4 0x12b32c /data/local/tmp/iree-benchmark-module
iree::hal::(anonymous namespace)::HALModuleState::ExecutableCachePrepare(iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&)
/usr/local/google/home/benoitjacob/iree/iree/modules/hal/hal_module.cc:667:5
#5 0x166cc4 /data/local/tmp/iree-benchmark-module
iree::StatusOr<iree::vm::ref<iree_hal_executable> > iree::vm::packing::DispatchFunctor<iree::hal::(anonymous namespace)::HALModuleState, iree::vm::ref<iree_hal_executable>, iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&>::ApplyFn<std::__ndk1::tuple<iree::vm::ref<iree_hal_executable_cache>, iree::vm::ref<iree_hal_executable_layout>, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> >, 0ul, 1ul, 2ul, 3ul>(iree::StatusOr<iree::vm::ref<iree_hal_executable> > (iree::hal::(anonymous namespace)::HALModuleState::*)(iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&), iree::hal::(anonymous namespace)::HALModuleState*, std::__ndk1::tuple<iree::vm::ref<iree_hal_executable_cache>, iree::vm::ref<iree_hal_executable_layout>, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> >&&, std::__ndk1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>)
/usr/local/google/home/benoitjacob/iree/iree/vm/module_abi_packing.h:578:12
iree::vm::packing::DispatchFunctor<iree::hal::(anonymous namespace)::HALModuleState, iree::vm::ref<iree_hal_executable>, iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&>::Call(void (iree::hal::(anonymous namespace)::HALModuleState::*)(), iree::hal::(anonymous namespace)::HALModuleState*, iree_vm_stack*, iree_vm_function_call_t const*, iree_vm_execution_result_t*)
/usr/local/google/home/benoitjacob/iree/iree/vm/module_abi_packing.h:563:0
#6 0x1721b8 /data/local/tmp/iree-benchmark-module
iree::vm::NativeModule<iree::hal::(anonymous namespace)::HALModuleState>::ModuleBeginCall(void*, iree_vm_stack*, iree_vm_function_call_t const*, iree_vm_execution_result_t*)
/usr/local/google/home/benoitjacob/iree/iree/vm/native_module_cc.h:238:5
#7 0x1c7d08 /data/local/tmp/iree-benchmark-module
iree_vm_bytecode_issue_import_call
/usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:479:31
#8 0x1c6950 /data/local/tmp/iree-benchmark-module
iree_vm_bytecode_call_import
/usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:560:10
#9 0x1c25c8 /data/local/tmp/iree-benchmark-module
iree_vm_bytecode_dispatch
/usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:1134:5
#10 0x1cd0fc /data/local/tmp/iree-benchmark-module
iree_vm_bytecode_module_begin_call
/usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_module.c:713:26
#11 0x1adbd8 /data/local/tmp/iree-benchmark-module
iree_vm_context_run_function
/usr/local/google/home/benoitjacob/iree/iree/vm/context.c:62:12
#12 0x1ad1fc /data/local/tmp/iree-benchmark-module
iree_vm_context_register_modules
/usr/local/google/home/benoitjacob/iree/iree/vm/context.c:411:14
#13 0x1ac558 /data/local/tmp/iree-benchmark-module
iree_vm_context_create_with_modules
/usr/local/google/home/benoitjacob/iree/iree/vm/context.c:240:7
#14 0x986b8 /data/local/tmp/iree-benchmark-module
iree::(anonymous namespace)::IREEBenchmark::Init()
/usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:179:5
iree::(anonymous namespace)::IREEBenchmark::Register()
/usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:147:0
#15 0x97304 /data/local/tmp/iree-benchmark-module
main
/usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:298:32
#16 0x7a798 /apex/com.android.runtime/lib64/bionic/libc.so
#0 0x9fdb8 /system/lib64/libclang_rt.asan-aarch64-android.so
#1 0x3d9f48 /data/local/tmp/iree-benchmark-module
operator new(unsigned long)
/buildbot/src/android/ndk-release-r21/external/libcxx/src/new.cpp:67:17
#2 0x1d5ef8 /data/local/tmp/iree-benchmark-module
iree::ref_ptr<iree::hal::dylib::DyLibExecutable> iree::make_ref<iree::hal::dylib::DyLibExecutable>()
/usr/local/google/home/benoitjacob/iree/iree/base/ref_ptr.h:41:21
iree::hal::dylib::DyLibExecutable::Load(iree::hal::ExecutableSpec)
/usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable.cc:27:0
#3 0x1d5724 /data/local/tmp/iree-benchmark-module
iree::hal::dylib::DyLibExecutableCache::PrepareExecutable(iree::hal::ExecutableLayout*, iree::hal::ExecutableCachingMode, iree::hal::ExecutableSpec const&)
/usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable_cache.cc:46:10
#4 0x18aa14 /data/local/tmp/iree-benchmark-module
iree_hal_executable_cache_prepare_executable
/usr/local/google/home/benoitjacob/iree/iree/hal/api.cc:1970:3
#5 0x12b32c /data/local/tmp/iree-benchmark-module
iree::hal::(anonymous namespace)::HALModuleState::ExecutableCachePrepare(iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&)
/usr/local/google/home/benoitjacob/iree/iree/modules/hal/hal_module.cc:667:5
#6 0x166cc4 /data/local/tmp/iree-benchmark-module
iree::StatusOr<iree::vm::ref<iree_hal_executable> > iree::vm::packing::DispatchFunctor<iree::hal::(anonymous namespace)::HALModuleState, iree::vm::ref<iree_hal_executable>, iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&>::ApplyFn<std::__ndk1::tuple<iree::vm::ref<iree_hal_executable_cache>, iree::vm::ref<iree_hal_executable_layout>, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> >, 0ul, 1ul, 2ul, 3ul>(iree::StatusOr<iree::vm::ref<iree_hal_executable> > (iree::hal::(anonymous namespace)::HALModuleState::*)(iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&), iree::hal::(anonymous namespace)::HALModuleState*, std::__ndk1::tuple<iree::vm::ref<iree_hal_executable_cache>, iree::vm::ref<iree_hal_executable_layout>, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> >&&, std::__ndk1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>)
/usr/local/google/home/benoitjacob/iree/iree/vm/module_abi_packing.h:578:12
iree::vm::packing::DispatchFunctor<iree::hal::(anonymous namespace)::HALModuleState, iree::vm::ref<iree_hal_executable>, iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&>::Call(void (iree::hal::(anonymous namespace)::HALModuleState::*)(), iree::hal::(anonymous namespace)::HALModuleState*, iree_vm_stack*, iree_vm_function_call_t const*, iree_vm_execution_result_t*)
/usr/local/google/home/benoitjacob/iree/iree/vm/module_abi_packing.h:563:0
#7 0x1721b8 /data/local/tmp/iree-benchmark-module
iree::vm::NativeModule<iree::hal::(anonymous namespace)::HALModuleState>::ModuleBeginCall(void*, iree_vm_stack*, iree_vm_function_call_t const*, iree_vm_execution_result_t*)
/usr/local/google/home/benoitjacob/iree/iree/vm/native_module_cc.h:238:5
#8 0x1c7d08 /data/local/tmp/iree-benchmark-module
iree_vm_bytecode_issue_import_call
/usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:479:31
#9 0x1c6950 /data/local/tmp/iree-benchmark-module
iree_vm_bytecode_call_import
/usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:560:10
#10 0x1c25c8 /data/local/tmp/iree-benchmark-module
iree_vm_bytecode_dispatch
/usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:1134:5
#11 0x1cd0fc /data/local/tmp/iree-benchmark-module
iree_vm_bytecode_module_begin_call
/usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_module.c:713:26
#12 0x1adbd8 /data/local/tmp/iree-benchmark-module
iree_vm_context_run_function
/usr/local/google/home/benoitjacob/iree/iree/vm/context.c:62:12
#13 0x1ad1fc /data/local/tmp/iree-benchmark-module
iree_vm_context_register_modules
/usr/local/google/home/benoitjacob/iree/iree/vm/context.c:411:14
#14 0x1ac558 /data/local/tmp/iree-benchmark-module
iree_vm_context_create_with_modules
/usr/local/google/home/benoitjacob/iree/iree/vm/context.c:240:7
#15 0x986b8 /data/local/tmp/iree-benchmark-module
iree::(anonymous namespace)::IREEBenchmark::Init()
/usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:179:5
iree::(anonymous namespace)::IREEBenchmark::Register()
/usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:147:0
#16 0x97304 /data/local/tmp/iree-benchmark-module
main
/usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:298:32
#17 0x7a798 /apex/com.android.runtime/lib64/bionic/libc.so
#18 0x952c8 /data/local/tmp/iree-benchmark-module
_start_main
??:0:0
#19 0x516e4 /data/local/tmp/iree-benchmark-module
??
??:0:0

Here is what a simple script using adb pull to get each file referenced by each stack frame and using the host llvm-symbolize on it, and correctly echo'ing the other lines that aren't stack frames so that the ASan report remains understandable, shows:

WRITE of size 8 at 0x0065720656c0 thread T0
#0 /usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable.cc:93:21 iree::hal::dylib::DyLibExecutable::Initialize(iree::hal::ExecutableSpec)
#1 /usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable.cc:28:3 iree::hal::dylib::DyLibExecutable::Load(iree::hal::ExecutableSpec)
#2 /usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable_cache.cc:46:10 iree::hal::dylib::DyLibExecutableCache::PrepareExecutable(iree::hal::ExecutableLayout*, iree::hal::ExecutableCachingMode, iree::hal::ExecutableSpec const&)
#3 /usr/local/google/home/benoitjacob/iree/iree/hal/api.cc:1970:3 iree_hal_executable_cache_prepare_executable
#4 /usr/local/google/home/benoitjacob/iree/iree/modules/hal/hal_module.cc:667:5 iree::hal::(anonymous namespace)::HALModuleState::ExecutableCachePrepare(iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&)
#5 /usr/local/google/home/benoitjacob/iree/iree/vm/module_abi_packing.h:563:0 iree::StatusOr<iree::vm::ref<iree_hal_executable> > iree::vm::packing::DispatchFunctor<iree::hal::(anonymous namespace)::HALModuleState, iree::vm::ref<iree_hal_executable>, iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&>::ApplyFn<std::__ndk1::tuple<iree::vm::ref<iree_hal_executable_cache>, iree::vm::ref<iree_hal_executable_layout>, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> >, 0ul, 1ul, 2ul, 3ul>(iree::StatusOr<iree::vm::ref<iree_hal_executable> > (iree::hal::(anonymous namespace)::HALModuleState::*)(iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&), iree::hal::(anonymous namespace)::HALModuleState*, std::__ndk1::tuple<iree::vm::ref<iree_hal_executable_cache>, iree::vm::ref<iree_hal_executable_layout>, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> >&&, std::__ndk1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>)
#6 /usr/local/google/home/benoitjacob/iree/iree/vm/native_module_cc.h:238:5 iree::vm::NativeModule<iree::hal::(anonymous namespace)::HALModuleState>::ModuleBeginCall(void*, iree_vm_stack*, iree_vm_function_call_t const*, iree_vm_execution_result_t*)
#7 /usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:479:31 iree_vm_bytecode_issue_import_call
#8 /usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:560:10 iree_vm_bytecode_call_import
#9 /usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:1134:5 iree_vm_bytecode_dispatch
#10 /usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_module.c:713:26 iree_vm_bytecode_module_begin_call
#11 /usr/local/google/home/benoitjacob/iree/iree/vm/context.c:62:12 iree_vm_context_run_function
#12 /usr/local/google/home/benoitjacob/iree/iree/vm/context.c:411:14 iree_vm_context_register_modules
#13 /usr/local/google/home/benoitjacob/iree/iree/vm/context.c:240:7 iree_vm_context_create_with_modules
#14 /usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:147:0 iree::(anonymous namespace)::IREEBenchmark::Init()
#15 /usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:298:32 main
#16 ??:0:0 __libc_init

0x0065720656c0 is located 0 bytes to the right of 128-byte region [0x006572065640,0x0065720656c0)
allocated by thread T0 here:
#0 /toolchain/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cc:145:3 malloc
#1 /buildbot/src/android/ndk-release-r21/external/libcxx/src/new.cpp:67:17 operator new(unsigned long)
#2 /usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable.cc:27:0 iree::ref_ptr<iree::hal::dylib::DyLibExecutable> iree::make_ref<iree::hal::dylib::DyLibExecutable>()
#3 /usr/local/google/home/benoitjacob/iree/iree/hal/dylib/dylib_executable_cache.cc:46:10 iree::hal::dylib::DyLibExecutableCache::PrepareExecutable(iree::hal::ExecutableLayout*, iree::hal::ExecutableCachingMode, iree::hal::ExecutableSpec const&)
#4 /usr/local/google/home/benoitjacob/iree/iree/hal/api.cc:1970:3 iree_hal_executable_cache_prepare_executable
#5 /usr/local/google/home/benoitjacob/iree/iree/modules/hal/hal_module.cc:667:5 iree::hal::(anonymous namespace)::HALModuleState::ExecutableCachePrepare(iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&)
#6 /usr/local/google/home/benoitjacob/iree/iree/vm/module_abi_packing.h:563:0 iree::StatusOr<iree::vm::ref<iree_hal_executable> > iree::vm::packing::DispatchFunctor<iree::hal::(anonymous namespace)::HALModuleState, iree::vm::ref<iree_hal_executable>, iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&>::ApplyFn<std::__ndk1::tuple<iree::vm::ref<iree_hal_executable_cache>, iree::vm::ref<iree_hal_executable_layout>, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> >, 0ul, 1ul, 2ul, 3ul>(iree::StatusOr<iree::vm::ref<iree_hal_executable> > (iree::hal::(anonymous namespace)::HALModuleState::*)(iree::vm::ref<iree_hal_executable_cache> const&, iree::vm::ref<iree_hal_executable_layout> const&, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> const&), iree::hal::(anonymous namespace)::HALModuleState*, std::__ndk1::tuple<iree::vm::ref<iree_hal_executable_cache>, iree::vm::ref<iree_hal_executable_layout>, unsigned int, iree::vm::ref<iree_vm_ro_byte_buffer_t> >&&, std::__ndk1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>)
#7 /usr/local/google/home/benoitjacob/iree/iree/vm/native_module_cc.h:238:5 iree::vm::NativeModule<iree::hal::(anonymous namespace)::HALModuleState>::ModuleBeginCall(void*, iree_vm_stack*, iree_vm_function_call_t const*, iree_vm_execution_result_t*)
#8 /usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:479:31 iree_vm_bytecode_issue_import_call
#9 /usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:560:10 iree_vm_bytecode_call_import
#10 /usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_dispatch.c:1134:5 iree_vm_bytecode_dispatch
#11 /usr/local/google/home/benoitjacob/iree/iree/vm/bytecode_module.c:713:26 iree_vm_bytecode_module_begin_call
#12 /usr/local/google/home/benoitjacob/iree/iree/vm/context.c:62:12 iree_vm_context_run_function
#13 /usr/local/google/home/benoitjacob/iree/iree/vm/context.c:411:14 iree_vm_context_register_modules
#14 /usr/local/google/home/benoitjacob/iree/iree/vm/context.c:240:7 iree_vm_context_create_with_modules
#15 /usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:147:0 iree::(anonymous namespace)::IREEBenchmark::Init()
#16 /usr/local/google/home/benoitjacob/iree/iree/tools/iree-benchmark-module-main.cc:298:32 main
#17 ??:0:0 __libc_init
#18 ??:0:0 _start_main
#19 ??:0:0 ??

bjacob added a commit to bjacob/iree that referenced this issue Oct 30, 2020
You just paste some ASan output to a text file and feed that to stdin to
this script. It will then pull the files out of the device and symbolize
them on the host using the NDK-provided host build of llvm-symbolizer.
Because it just pulls files from the device, there's no need to point
this script to any particular obj dir. It's easy to use.

ANDROID_NDK=~/android-ndk-r21d ~/android-symbolize.sh < ~/a

Discussion of alternatives: android/ndk#753
bjacob added a commit to iree-org/iree that referenced this issue Nov 2, 2020
…n. (#3673)

* Add script to symbolize android stacks, particularly for use with Asan.

You just paste some ASan output to a text file and feed that to stdin to
this script. It will then pull the files out of the device and symbolize
them on the host using the NDK-provided host build of llvm-symbolizer.
Because it just pulls files from the device, there's no need to point
this script to any particular obj dir. It's easy to use.

ANDROID_NDK=~/android-ndk-r21d ~/android-symbolize.sh < ~/a

Discussion of alternatives: android/ndk#753

* rename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants