stack corruption detected (-fstack-protector)

stack corruption detected (-fstack-protector),第1张

编译安卓arm64-v8a的库,运行时,会报错,同样的代码编译armeabi-v7a时,不会报错,报错如下:

    --------- beginning of crash
2022-03-08 10:02:22.166 24209-24209/com.ulucu.play A/libc: stack corruption detected (-fstack-protector)
2022-03-08 10:02:22.166 24209-24209/com.ulucu.play A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 24209 (com.ulucu.play), pid 24209 (com.ulucu.play)
2022-03-08 10:02:22.317 32575-32575/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-03-08 10:02:22.318 32575-32575/? A/DEBUG: Build fingerprint: 'HUAWEI/EML-AL00/HWEML:10/HUAWEIEML-AL00/10.0.0.176C00:user/release-keys'
2022-03-08 10:02:22.318 32575-32575/? A/DEBUG: Revision: '0'
2022-03-08 10:02:22.318 32575-32575/? A/DEBUG: ABI: 'arm64'
2022-03-08 10:02:22.321 32575-32575/? A/DEBUG: SYSVMTYPE: Maple
    APPVMTYPE: Art
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG: Timestamp: 2022-03-08 10:02:22+0800
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG: pid: 24209, tid: 24209, name: com.ulucu.play  >>> com.ulucu.play <<<
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG: uid: 10699
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG: signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG: Abort message: 'stack corruption detected (-fstack-protector)'
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     x0  0000000000000000  x1  0000000000005e91  x2  0000000000000006  x3  0000007fe5fff2e0
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     x4  0000000000808080  x5  0000000000808080  x6  0000000000808080  x7  0000000000000030
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     x8  00000000000000f0  x9  a43a0f1362ea0521  x10 0000000000000001  x11 0000000000000000
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     x12 fffffff0fffffbdf  x13 000000006226b92e  x14 0002696280927fe3  x15 0000112e99aa9f68
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     x16 0000007cd4067a08  x17 0000007cd40477c0  x18 00000000ffffe333  x19 0000000000005e91
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     x20 0000000000005e91  x21 00000000ffffffff  x22 0000007be139b3c0  x23 0000007cd40693e8
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     x24 0000000000000004  x25 0000007cd72f8020  x26 0000007c518108b0  x27 0000000000000002
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     x28 0000007fe5fff4a0  x29 0000007fe5fff380
2022-03-08 10:02:22.322 32575-32575/? A/DEBUG:     sp  0000007fe5fff2c0  lr  0000007cd3ffc640  pc  0000007cd3ffc66c
2022-03-08 10:02:22.503 32575-32575/? A/DEBUG: backtrace:
2022-03-08 10:02:22.504 32575-32575/? A/DEBUG:       #00 pc 000000000007066c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: b91c775ccc9b0556e91bc575a2511cd0)
2022-03-08 10:02:22.504 32575-32575/? A/DEBUG:       #01 pc 00000000000babec  /apex/com.android.runtime/lib64/bionic/libc.so (__stack_chk_fail+20) (BuildId: b91c775ccc9b0556e91bc575a2511cd0)
2022-03-08 10:02:22.504 32575-32575/? A/DEBUG:       #02 pc 000000000037a8ec  /data/app/com.ulucu.play-TeZKZsKMbdlM2sPz5SicHQ==/lib/arm64/libAYClient_SDK_Android.so (CAYNativeSDK::getPlayerProgress(SCameraChannelInfo const&)+356)
2022-03-08 10:02:22.504 32575-32575/? A/DEBUG:       #03 pc 0000000000121c20  /data/app/com.ulucu.play-TeZKZsKMbdlM2sPz5SicHQ==/lib/arm64/libAYClient_SDK_Android.so (Java_com_ulucu_play_base_JAYNetPlay_getPlayerProgress+232)

解决的方法是:android.mk文件的LOCAL_CFLAGS编译器标记加上-fno-stack-protector这个编译选项,把“stack smashing detected”机制关闭即可。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/992819.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-21
下一篇2022-05-21

发表评论

登录后才能评论

评论列表(0条)

    保存