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

libclang_rt.asan-arm-android.so crash on nexus 5 Android 4.4.4 #732

Closed
bending1 opened this issue Oct 25, 2016 · 4 comments
Closed

libclang_rt.asan-arm-android.so crash on nexus 5 Android 4.4.4 #732

bending1 opened this issue Oct 25, 2016 · 4 comments

Comments

@bending1
Copy link

hi,

i use ndk to compile my shared library with below paraments, when run the APP, met the crash.
LOCAL_CFLAGS := -fsanitize=address -fno-omit-frame-pointer
LOCAL_LDFLAGS := -fsanitize=address
LOCAL_ARM_MODE := arm

from the backtrace, the crash in libclang_rt.asan-arm-android.so, it seems met null pointer.
backtrace:
#00 pc 00000000
#1 pc 0008c5d8 /system/lib/libclang_rt.asan-arm-android.so
#2 pc 0008db34 /system/lib/libclang_rt.asan-arm-android.so
#3 pc 0008da80 /system/lib/libclang_rt.asan-arm-android.so
#4 pc 0007f520 /system/lib/libclang_rt.asan-arm-android.so
#5 pc 00000600 /data/app-lib/com.example.inlinehookdemo-1/libhelloworld.so
#6 pc 0000274d /system/bin/link

Someone can tell me what's wrong with me? Thank you!

ndk version: r13d
device: nexus5 Android4.4.4

@yugr
Copy link

yugr commented Oct 25, 2016

@bending1 please post code snippets, not screenshots.

@bending1
Copy link
Author

bending1 commented Oct 25, 2016

@yugr
Android.mk
LOCAL_PATH:=$(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := helloworld
LOCAL_SRC_FILES := helloworld.cpp
LOCAL_CFLAGS := -fsanitize=address -fno-omit-frame-pointer
LOCAL_LDFLAGS := -fsanitize=address
LOCAL_ARM_MODE := arm
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
include $(BUILD_SHARED_LIBRARY)

helloworld.cpp
extern "C"{
JNIEXPORT void JNICALL Java_com_example_inlinehookdemo_MainActivity_mytest(JNIEnv env) {
char
str = "hello";
LOGD("my_test str:%s", str);
}
}

I call this function in APK directly. When launch the APK, met the crash,
Thanks for your help!

@bending1
Copy link
Author

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_SRC_FILES := test.cpp
LOCAL_CFLAGS := -fsanitize=address -fno-omit-frame-pointer
LOCAL_LDFLAGS := -fsanitize=address
LOCAL_ARM_MODE := arm
NDK_TOOLCHAIN_VERSION=clang
include $(BUILD_EXECUTABLE)

If i compile a executable, it works. But compile shared library, it doesn't work.

@morehouse
Copy link
Contributor

Please provide a repro and re-open if still an issue.

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

No branches or pull requests

3 participants