Skip to content

ASAN: initialization failure on Android #1023

Closed
@alek314

Description

@alek314

In the function call InitializeAsanCommonInterceptors(), the following check failed:
"((__interception::real_memcpy)) != (0)"
NDK version is r16b with gnustl-static, Android 8.0, using wrap.sh approach.
getenforce shows "PERMISSIVE"

After update to NDK r18b, with -DANDROID_STL=c++_static, the crashed stack changed:
__cxa_atexit
unknown>
unknown>
__dl__ZL13call_functionPKcPFviPPcS2_ES0
_dl__ZL10call_arrayIPFviPPcS1_EEvPKcPT_jbS5
__dl__ZN6soinfo17call_constructorsEV
__dl__ZN6soinfo17call_constructorsEV
__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv
__dl__ZL10dlopen_extPKciPK17android_dlextinfoPKv
android_dlopen_ext
android::OpenNativeLibrary

Any idea? thank you

Activity

eugenis

eugenis commented on Nov 20, 2018

@eugenis
Contributor
alek314

alek314 commented on Nov 21, 2018

@alek314
Author

Eugenis, you are right.
I am using Android Studio for development, and I manually put the wrap.sh script right next to asan-arm-android.so, in the jniLibs/armeabi-v7a folder. But wrap.sh did not made it's way to the APK.

alek314

alek314 commented on Nov 21, 2018

@alek314
Author

In order to work with AndroidStudio, wrap.sh should be put into folder app/resources/lib/armeabi-v7a, then wrap.sh is properly packaged along side asan.so.
When the app start, the following error occured:
wrap.sh : executing /data/app/com.dy3d-MRYVTaN0O7_J5V3ARv77hA==/lib/arm/wrap.sh failed: No such file or directory
logwrapper: executing /data/app/com.dy3d-MRYVTaN0O7_J5V3ARv77hA==/lib/arm/wrap.sh failed: No such file or directory

It turns out the problem is the line ending of wrap.sh is CRLF, which should be LF instead.
https://unix.stackexchange.com/questions/27054/bin-bash-no-such-file-or-directory

Hope this would help someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @eugenis@alek314

        Issue actions

          ASAN: initialization failure on Android · Issue #1023 · google/sanitizers