android / ndk

The Android Native Development Kit
1.95k stars 254 forks source link

[BUG] r21 beta1: ndk-stack regression #1124

Closed andreya108 closed 4 years ago

andreya108 commented 4 years ago

Command

adb logcat | ~/android-sdk-linux/ndk/21.0.5935234/ndk-stack -sym ~/AndroidStudioProjects/myapp/app/src/aes/jniLibs/armeabi-v7a

when used ndk-stack from r21 results with:

********** Crash dump: **********
Build fingerprint: 'TCL/5059D_RU/U5A_PLUS_4G:8.1.0/O11019/v6J6K-0:user/release-keys'
Crash dump is completed

No more stacktraces decoded.

And it is ok when running from r19c (complete stacktraces are shown):

adb logcat | ~/android-sdk-linux/ndk/19.2.5345600/ndk-stack -sym ~/AndroidStudioProjects/myapp/app/src/aes/jniLibs/armeabi-v7a
andreya108 commented 4 years ago

ps: in -sym directory located shared libraries built with ndk r21 (with debug symbols not stripped).

enh-google commented 4 years ago

can you attach some example input that works with r19 but not with r20? it's working for us with our test cases, so having yours will help us find the problem (and add the missing test case so we don't regress in future).

only include the crash part of logcat, in case there's any PII In the rest of the logging!

andreya108 commented 4 years ago

Here it is:

2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: Build fingerprint: 'TCL/5059D_RU/U5A_PLUS_4G:8.1.0/O11019/v6J6K-0:user/release-keys'
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: Revision: '0'
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: ABI: 'arm'
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: pid: 19036, tid: 19235, name: g corrupted.dst  >>> com.vipnet.client <<<
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: Cause: null pointer dereference
2019-11-08 07:46:16.318 19239-19239/? A/DEBUG:     r0 00000000  r1 90a73348  r2 8f6ef214  r3 93aa3bf9
2019-11-08 07:46:16.318 19239-19239/? A/DEBUG:     r4 8f6f05b0  r5 90a73348  r6 00000000  r7 8f6ef1e0
2019-11-08 07:46:16.318 19239-19239/? A/DEBUG:     r8 8f6f05b0  r9 8f6f05b8  sl 00000000  fp 00000000
2019-11-08 07:46:16.318 19239-19239/? A/DEBUG:     ip afd6dfd4  sp 8f6ef1c0  lr 93aa0ca5  pc 93aa0bca  cpsr a0010030
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG: backtrace:
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #00 pc 000f2bca  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #01 pc 000f2ca1  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #02 pc 000f5c0d  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #03 pc 000f614d  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #04 pc 0019ca7d  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #05 pc 00039063  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #06 pc 0003a229  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #07 pc 0003a39d  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #08 pc 00047ee7  /system/lib/libc.so (__pthread_start(void*)+22)
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #09 pc 0001afbd  /system/lib/libc.so (__start_thread+32)
andreya108 commented 4 years ago

Previous crash was copied from Android Studio logcat view (seems it's slightly modified)

Here is another one (directly from logcat):

11-08 08:30:12.701  8848  8848 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-08 08:30:12.701  8848  8848 F DEBUG   : LineageOS Version: 'unknown'
11-08 08:30:12.701  8848  8848 F DEBUG   : Build fingerprint: 'Xiaomi/kenzo/kenzo:6.0.1/MMB29M/V8.2.1.0.MHOCNDL:user/release-keys'
11-08 08:30:12.701  8848  8848 F DEBUG   : Revision: '0'
11-08 08:30:12.701  8848  8848 F DEBUG   : ABI: 'arm64'
11-08 08:30:12.701  8848  8848 F DEBUG   : pid: 8746, tid: 8843, name: IPLIR_CFG/30696  >>> com.vipnet.client <<<
11-08 08:30:12.701  8848  8848 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
11-08 08:30:12.701  8848  8848 F DEBUG   : Abort message: 'FORTIFY: pthread_mutex_destroy called on a destroyed mutex (0x7b469e24f4)'
11-08 08:30:12.701  8848  8848 F DEBUG   :     x0  0000000000000000  x1  000000000000228b  x2  0000000000000006  x3  0000000000000008
11-08 08:30:12.701  8848  8848 F DEBUG   :     x4  0000000000000000  x5  0000000000000000  x6  0000000000000000  x7  0000000000000010
11-08 08:30:12.701  8848  8848 F DEBUG   :     x8  0000000000000083  x9  0000007be4278a50  x10 fffffff87ffffbdf  x11 0000000000000001
11-08 08:30:12.701  8848  8848 F DEBUG   :     x12 0000000000000008  x13 0000000000000000  x14 0000000000000000  x15 002210198485a7fd
11-08 08:30:12.701  8848  8848 F DEBUG   :     x16 0000007be42b02a0  x17 0000007be41ee2a0  x18 0000000000000000  x19 000000000000222a
11-08 08:30:12.701  8848  8848 F DEBUG   :     x20 000000000000228b  x21 0000000000000083  x22 0000007b3f3f1588  x23 0000007b3f3f1588
11-08 08:30:12.701  8848  8848 F DEBUG   :     x24 0000007b466c5000  x25 0000007b3f2f4000  x26 0000007b3f4f7588  x27 0000007b46294600
11-08 08:30:12.701  8848  8848 F DEBUG   :     x28 0000007b3f4f5eb0  x29 0000007b3f3f1160
11-08 08:30:12.701  8848  8848 F DEBUG   :     sp  0000007b3f3f1120  lr  0000007be41e2a58  pc  0000007be41e2a84
11-08 08:30:12.703  8848  8848 F DEBUG   : 
11-08 08:30:12.703  8848  8848 F DEBUG   : backtrace:
11-08 08:30:12.703  8848  8848 F DEBUG   :     #00 pc 0000000000021a84  /system/lib64/libc.so (abort+124)
11-08 08:30:12.703  8848  8848 F DEBUG   :     #01 pc 0000000000085818  /system/lib64/libc.so (__fortify_fatal(char const*, ...)+120)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #02 pc 0000000000085798  /system/lib64/libc.so (pthread_mutex_destroy+160)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #03 pc 0000000000096554  /data/app/com.vipnet.client-pm521aHFVitzqtc9_QgHnA==/lib/arm64/libcsp.so (offset 0x3a000)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #04 pc 00000000000af1b0  /data/app/com.vipnet.client-pm521aHFVitzqtc9_QgHnA==/lib/arm64/libcsp.so (offset 0x3a000)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #05 pc 000000000005cf24  /data/app/com.vipnet.client-pm521aHFVitzqtc9_QgHnA==/lib/arm64/libcsp.so (offset 0x3a000)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #06 pc 000000000051a320  /data/app/com.vipnet.client-pm521aHFVitzqtc9_QgHnA==/lib/arm64/libvipnet.so (offset 0x2b7000)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #07 pc 0000000000355474  /data/app/com.vipnet.client-pm521aHFVitzqtc9_QgHnA==/lib/arm64/libvipnet.so (offset 0x2b7000)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #08 pc 00000000002b91d0  /data/app/com.vipnet.client-pm521aHFVitzqtc9_QgHnA==/lib/arm64/libvipnet.so (offset 0x2b7000)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #09 pc 00000000002c2638  /data/app/com.vipnet.client-pm521aHFVitzqtc9_QgHnA==/lib/arm64/libvipnet.so (offset 0x2b7000)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #10 pc 00000000000841b4  /system/lib64/libc.so (__pthread_start(void*)+36)
11-08 08:30:12.704  8848  8848 F DEBUG   :     #11 pc 0000000000023384  /system/lib64/libc.so (__start_thread+68)
DanAlbert commented 4 years ago

There was already one patch to fix ndk-stack post beta 1. I think it fixed a case where it wouldn't detect crashes if you didn't include the row of ***** at the top of the crash, but idr. @cferris1000 will know.

enh-google commented 4 years ago

i was going to say i couldn't reproduce your failure ... but then i realized i was testing r19 and r20 :-)

you're right: r19 and r20 work, and r21 doesn't.

i think @DanAlbert is talking about https://android-review.git.corp.google.com/c/platform/ndk/+/1142328 so i'll check to see if that fixes things...

enh-google commented 4 years ago

yeah, here's the output from a patched r21 (obviously i don't have your symbols :-) ):

~/Downloads$ ./android-ndk-r21/ndk-stack --sym /tmp
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: Build fingerprint: 'TCL/5059D_RU/U5A_PLUS_4G:8.1.0/O11019/v6J6K-0:user/release-keys'
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: Revision: '0'
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: ABI: 'arm'
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: pid: 19036, tid: 19235, name: g corrupted.dst  >>> com.vipnet.client <<<
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
2019-11-08 07:46:16.317 19239-19239/? A/DEBUG: Cause: null pointer dereference
2019-11-08 07:46:16.318 19239-19239/? A/DEBUG:     r0 00000000  r1 90a73348  r2 8f6ef214  r3 93aa3bf9
2019-11-08 07:46:16.318 19239-19239/? A/DEBUG:     r4 8f6f05b0  r5 90a73348  r6 00000000  r7 8f6ef1e0
2019-11-08 07:46:16.318 19239-19239/? A/DEBUG:     r8 8f6f05b0  r9 8f6f05b8  sl 00000000  fp 00000000
2019-11-08 07:46:16.318 19239-19239/? A/DEBUG:     ip afd6dfd4  sp 8f6ef1c0  lr 93aa0ca5  pc 93aa0bca  cpsr a0010030
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG: backtrace:
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #00 pc 000f2bca  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #01 pc 000f2ca1  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #02 pc 000f5c0d  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #03 pc 000f614d  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #04 pc 0019ca7d  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #05 pc 00039063  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #06 pc 0003a229  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #07 pc 0003a39d  /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #08 pc 00047ee7  /system/lib/libc.so (__pthread_start(void*)+22)
2019-11-08 07:46:16.325 19239-19239/? A/DEBUG:     #09 pc 0001afbd  /system/lib/libc.so (__start_thread+32)
********** Crash dump: **********
Build fingerprint: 'TCL/5059D_RU/U5A_PLUS_4G:8.1.0/O11019/v6J6K-0:user/release-keys'
#00 0x000f2bca /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
#01 0x000f2ca1 /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
#02 0x000f5c0d /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
#03 0x000f614d /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
#04 0x0019ca7d /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
#05 0x00039063 /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
#06 0x0003a229 /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
#07 0x0003a39d /data/app/com.vipnet.client-ZXZixdv7X0n6GHAH_Qwkjg==/lib/arm/libvipnet.so
#08 0x00047ee7 /system/lib/libc.so (__pthread_start(void*)+22)
#09 0x0001afbd /system/lib/libc.so (__start_thread+32)
~/Downloads$ 

it's a pretty small edit (just the one file https://android-review.git.corp.google.com/c/platform/ndk/+/1142328/3/ndk-stack.py matters --- the rest is new tests) if you want to patch your copy locally until beta 2 is out...

DanAlbert commented 4 years ago

Cool, thanks for checking. I'll go ahead and close this then. @andreya108 if for some reason you're still seeing the problem even with that patch lmk and I'll reopen.

andreya108 commented 4 years ago

@DanAlbert, unfortunately, I have no access to the above site (looks like it's something Google-internal). Can you provide public link?

DanAlbert commented 4 years ago

That's weird. I didn't enough know we had internal URLs that pointed to AOSP. No idea how he got that. Here's the same link but better: https://android-review.googlesource.com/c/platform/ndk/+/1142328/3/ndk-stack.py

andreya108 commented 4 years ago

@DanAlbert, thank you! That patch fixes the issue.

DanAlbert commented 4 years ago

Excellent, thanks for confirming!

enh-google commented 4 years ago

(weird. i hadn't noticed the ".git.corp" in my link. fwiw, that came from cs/ -> history -> gittiles. i hadn't even noticed i was on a different gerrit. [although presumably it's the same gerrit, different DNS name.])