问题
Iam facing the issue only in OnePlus, Samsung , Poco F1 with Android OS version 10.
It's working in pixel devices with Android 10.
Please find the error logs below
Build fingerprint: 'Xiaomi/beryllium/beryllium:10/QKQ1.190828.002/V11.0.6.0.QEJMIXM:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2020-03-16 18:10:34+0530
pid: 2594, tid: 2737, name: JavaBridge >>> com.mymobile<<<
uid: 10362
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7188e089db
Cause: execute-only (no-read) memory access error; likely due to data in .text.
x0 0000000000000100 x1 000000705d3f2fb0 x2 0000000000000000 x3 0000000000000008
x4 00000000000000e2 x5 000000705d3fbd60 x6 000000705d3fbd60 x7 707265676e69662e
x8 0000007188e089d4 x9 0000000000000000 x10 0000000000000007 x11 0000000000000000
x12 0000000000000000 x13 0000000000000001 x14 000000705d3f2f58 x15 000000705d3f4bcc
x16 00000060a530d558 x17 0000007188e0ae20 x18 000000001ba3a243 x19 000000705d3f7038
x20 0000000000000001 x21 000000705d3f4188 x22 000000705d3f6f1c x23 0000000000000002
x24 0000000000000002 x25 0000007081ea45b0 x26 000000710786b8b0 x27 0000000000000005
x28 0000000000000001 x29 000000705d3f6f90
sp 000000705d3f31e0 lr 000000708c9058d8 pc 000000708c9063d8
backtrace:
#00 pc 00000000000053d8 /data/app/com.mymobile-_0ls0Aom7N8BP86o4bZVYQ==/lib/arm64/libag3.so (BuildId: 25ee893fb2620c6009ca1a6ef581e24e27c00a36)
#01 pc 000000000000c2c4 /data/app/com.mymobile-_0ls0Aom7N8BP86o4bZVYQ==/lib/arm64/libag3.so (BuildId: 25ee893fb2620c6009ca1a6ef581e24e27c00a36)
#02 pc 000000000002b0d4 /data/app/com.mymobile-_0ls0Aom7N8BP86o4bZVYQ==/lib/arm64/libag3.so (Java_com_apiguard3_signals_NdkManager_collectSignal+196) (BuildId: 25ee893fb2620c6009ca1a6ef581e24e27c00a36)
#03 pc 00000000000b90fc /data/app/com.mymobile-_0ls0Aom7N8BP86o4bZVYQ==/oat/arm64/base.odex (art_jni_trampoline+236)
#04 pc 0000000000136334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#05 pc 0000000000144fec /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#06 pc 00000000002e27cc /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#07 pc 00000000002dda2c /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+892) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#08 pc 00000000005a20b0 /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+424) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#09 pc 0000000000130914 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#10 pc 0000000000de4afa /data/app/com.mymobile-_0ls0Aom7N8BP86o4bZVYQ==/oat/arm64/base.vdex (com.apiguard3.signals.NdkManager.b0414ДДДД0414+20)
#11 pc 00000000002b3ae0 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.17460956533834400288+240) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#12 pc 00000000005912f0 /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1032) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#13 pc 000000000013f468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#14 pc 0000000000136334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 2bc2e11d57f839316bf2a42bbfdf943a)
#15 pc 0000000000144fec /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JVal
Can any one help in resolving this Thanks in advance
回答1:
The root cause of this crash is caused by behavior change from Android 10. Please refer to the following pages to understand the problem: https://developer.android.com/about/versions/10/behavior-changes-all https://developer.android.com/about/versions/10/behavior-changes-all
In a summary the issue is: Starting in Android 10, executable segments of system binaries and libraries are mapped into memory execute-only (non-readable) as a hardening technique against code-reuse attacks. If your app performs read operations into memory segments marked as execute-only – whether from bug, vulnerability, or intentional memory inspection – the system sends a SIGSEGV signal to your app.
As workaround it says to call "mprotect" to execute the method where crash happen. You can refer here to understand how to call this method: https://man7.org/linux/man-pages/man2/mprotect.2.html
I would say it is very annoying to implement this workaround as it add additional system call and not convenient at all.However i don't see a better way.
来源:https://stackoverflow.com/questions/60720511/after-migrating-from-sdk-28-to-sdk-29-in-android-my-app-crashed-and-facing-sig