Skip to content

native crash libsqlcipher.so 000c6008 #469

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

Closed
KSKjust opened this issue Aug 20, 2019 · 33 comments
Closed

native crash libsqlcipher.so 000c6008 #469

KSKjust opened this issue Aug 20, 2019 · 33 comments
Labels
bug A software defect within SQLCipher for Android

Comments

@KSKjust
Copy link

KSKjust commented Aug 20, 2019

Expected Behavior

Actual Behavior

Crash type: 'native'
Start time: '2019-08-19T08:52:51.198+0800'
Crash time: '2019-08-19T08:52:51.208+0800'
App ID: 'com.demo.ksk'
App version: '5.3.2'
CPU loadavg: 'unknown'
CPU online: '0-7'
CPU offline: ''
System memory total: '3805108 kB'
System memory used: '3150420 kB'
Number of threads: '50'
Rooted: 'No'
API level: '28'
OS version: '9'
Kernel version: 'Linux version 4.9.111 #1 SMP PREEMPT Fri Mar 29 23:12:42 CST 2019 (armv8l)'
ABI list: 'arm64-v8a,armeabi-v7a,armeabi'
Manufacturer: 'HUAWEI'
Brand: 'HUAWEI'
Model: 'MHA-AL00'
Build fingerprint: 'HUAWEI/MHA-AL00/HWMHA:9/HUAWEIMHA-AL00/179C00R1:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 22897, tid: 23106, name: Thread-17  >>> com.demo.ksk <<<
signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xc3c2a008
    r0  00000000  r1  20000011  r2  c5aea220  r3  00000008
    r4  c3d3a6a8  r5  c47ec070  r6  00000001  r7  fffffb27
    r8  c3b7fbd8  r9  f10182c0  r10 00000000  r11 f1018628
    ip  50b1bcf1  sp  c47ec050  lr  c3b7fcf8  pc  c3c2a008

backtrace:
    #00 pc 000c6008  /data/app/com.demo.ksk-aiBDkGn3pZ-yJU_8cCthdg==/lib/arm/libsqlcipher.so

java stacktrace:
    at java.lang.Runtime.nativeLoad(Native Method)
    at java.lang.Runtime.loadLibrary0(Runtime.java:1014)
    at java.lang.System.loadLibrary(System.java:1672)
    at net.sqlcipher.database.SQLiteDatabase$1.loadLibraries(src:223)
    at net.sqlcipher.database.SQLiteDatabase.loadLibs(src:240)
    at net.sqlcipher.database.SQLiteDatabase.loadLibs(src:219)
    at net.sqlcipher.database.SQLiteDatabase.loadLibs(src:212)
    at com.demo.ksk.service.dao.DaoCipherInit.(src:42)
    at com.demo.ksk.service.DaoManager.a(src:71)
    at com.demo.ksk.service.ConfigManager.a(src:28)
    at com.demo.ksk.service.ServiceProvider.b(src:47)
    at com.demo.ksk.manager.Manager.a(src:176)
    at com.demo.ksk.access.Engine$1.run(src:163)
    at java.lang.Thread.run(Thread.java:784)

Steps to Reproduce

SQLCipher version (can be identified by executing PRAGMA cipher_version;):

SQLCipher for Android version:
api 'net.zetetic:android-database-sqlcipher:4.1.3'

Note: If you are not posting a specific issue for the SQLCipher library, please consider posting your question to the SQLCipher discuss site. Thanks!

@developernotes
Copy link
Member

Hi @KSKjust

Are you able to run the SQLCipher for Android test suite on that device? Have you tried utilizing the latest build of the library? Currently it is at 4.2.0.

@KSKjust
Copy link
Author

KSKjust commented Aug 21, 2019

Thank you for your reply! And I'm wondering if the latest version (4.2.0 as you mentioned) had solved this problem? Because we found this problem on our published app which runs on the online environment, but it is very hard to reproduce the problem.

@KSKjust
Copy link
Author

KSKjust commented Aug 21, 2019

This is the data of the crash during the recent 1 month. Hope it can give you some help.
clipboard_2019-08-21_1151

@developernotes
Copy link
Member

Hi @KSKjust

Below are a few additional questions that may be helpful in troubleshooting the problem:

  • What target CPU platforms are you including support for within your application?
  • Are you using the ABI splits feature within Gradle?

@KSKjust
Copy link
Author

KSKjust commented Aug 22, 2019

Thanks,we only use
ndk { abiFilter "armeabi-v7a" }

@developernotes
Copy link
Member

Hi @KSKjust

You might want to review all the native dependencies that you are bundling with your application and see if you can relax the abiFilter to not be so restrictive.

For example, the SM-A505F which you are reporting a high number of crashes on is an Armv8-A 64-bit CPU, which SQLCipher for Android ships with support for.

@mimiks
Copy link

mimiks commented Aug 22, 2019

We experienced the same native crash in our app with many users. The crash occurs randomly when writing to the database, although on the LG G2 (LG-D802) with Android 5 it crashes almost every time.

I can reproduce it with the Android test suite running the "Support Test Suite". It doesn't always crash in the same test though. Sometimes in the first one, sometimes later.

I/PragmaCipherVersionTest( 2275): Test complete: PRAGMA cipher_version Test ran in 0,00 seconds using library version 4.2.0
I/TestSuiteBehaviorsActivity( 2275): PRAGMA cipher_version Test - success:true
I/Zetetic ( 2275): Running test:Verify Cipher Provider Test
I/VerifyCipherProviderTest( 2275): Before prepareDatabaseEnvironment
I/Zetetic ( 2275): Entered prepareDatabaseEnvironment
I/Zetetic ( 2275): Before getDatabasePath
I/Zetetic ( 2275): Before mkdirs on parent of database path
I/VerifyCipherProviderTest( 2275): Before createDatabase
F/libc    ( 2275): Fatal signal 4 (SIGILL), code 1, fault addr 0x9b9a7d68 in tid 2626 (AsyncTask #1)
I/VerifyCipherProviderTest( 2275): Before setUp
I/VerifyCipherProviderTest( 2275): Test complete: Verify Cipher Provider Test ran in 0,00 seconds using library version 4.2.0
I/TestSuiteBehaviorsActivity( 2275): Verify Cipher Provider Test - success:true
I/Zetetic ( 2275): Running test:Verify Cipher Provider Version
I/VerifyCipherProviderVersionTest( 2275): Before prepareDatabaseEnvironment
I/Zetetic ( 2275): Entered prepareDatabaseEnvironment
I/Zetetic ( 2275): Before getDatabasePath
I/Zetetic ( 2275): Before mkdirs on parent of database path
I/DEBUG   (17127): [2019-08-22 17:07:47.523]
I/DEBUG   (17127): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (17127): Build fingerprint: 'lge/g2_open_com/g2:5.0.2/LRX22G/151070125729c:user/release-keys'
I/DEBUG   (17127): Revision: '10'
I/DEBUG   (17127): ABI: 'arm'
I/DEBUG   (17127): pid: 2275, tid: 2626, name: AsyncTask #1  >>> net.zetetic.sqlcipher.test <<<
I/DEBUG   (17127): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0x9b9a7d68
W/NativeCrashListener( 1649): Couldn't find ProcessRecord for pid 1530015793
I/DEBUG   (17127):     r0 00000002  r1 9bbe623c  r2 00000050  r3 9bab77b4
E/DEBUG   (17127): AM write failure (32 / Broken pipe)
I/DEBUG   (17127):     r4 00000000  r5 9b4512c0  r6 9b4512c0  r7 a8f6bb00
I/DEBUG   (17127):     r8 00000050  r9 00000010  sl 00000ff0  fp a8f50018
I/DEBUG   (17127):     ip 9bab4810  sp 9bbe61f8  lr 9b9a1c40  pc 9b9a7d68  cpsr 200e0010
I/DEBUG   (17127): 
I/DEBUG   (17127): backtrace:
I/DEBUG   (17127):     #00 pc 000c6d68  /data/app/net.zetetic.sqlcipher.test-1/lib/arm/libsqlcipher.so
I/DEBUG   (17127): 
I/DEBUG   (17127): Tombstone written to: /data/tombstones/tombstone_06

I'll be happy to provide more output, if helpful.

@sjlombardo
Copy link
Member

@mimiks - is your application also using an abiFilter?

@mimiks
Copy link

mimiks commented Aug 23, 2019

@sjlombardo - the crash output above is from the "Android test suite" app with default settings (no abiFilter).

But our app is also using abiFilters:

ndk {
    abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}

@developernotes
Copy link
Member

@mimiks

I/DEBUG (17127): Tombstone written to: /data/tombstones/tombstone_06

Would you use adb bugreport feature to pull this file off the device and share it for further review? Instructions for using this can be found here. Thanks!

@mimiks
Copy link

mimiks commented Aug 23, 2019

@developernotes
Unfortunately this is an old device that does not include tombstones in the adb bugreport output. I'm going to try to get hold of the file another way.

@mimiks
Copy link

mimiks commented Aug 24, 2019

@developernotes @sjlombardo

I've now managed to get a tombstone. I also attempted to symbolize the stack dump with ndk-stack.

In order to be able to symbolize the dump I used a debug version of the sqlcipher library built from scratch instead of the prebuilt version from the repository. Please let me know if you need any more information.

tombstone.txt
ndk-stack.txt

@BlackBirds
Copy link

BlackBirds commented Aug 26, 2019

`Crash type: 'native'
Start time: '2019-08-19T08:52:51.198+0800'
Crash time: '2019-08-19T08:52:51.208+0800'
App ID: 'com.demo.ksk'
App version: '5.3.2'
CPU loadavg: 'unknown'
CPU online: '0-7'
CPU offline: ''
System memory total: '3805108 kB'
System memory used: '3150420 kB'
Number of threads: '50'
Rooted: 'No'
API level: '28'
OS version: '9'
Kernel version: 'Linux version 4.9.111 #1 SMP PREEMPT Fri Mar 29 23:12:42 CST 2019 (armv8l)'
ABI list: 'arm64-v8a,armeabi-v7a,armeabi'
Manufacturer: 'HUAWEI'
Brand: 'HUAWEI'
Model: 'MHA-AL00'
Build fingerprint: 'HUAWEI/MHA-AL00/HWMHA:9/HUAWEIMHA-AL00/179C00R1:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 22897, tid: 23106, name: Thread-17 >>> com.demo.ksk <<<
signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xc3c2a008
r0 00000000 r1 20000011 r2 c5aea220 r3 00000008
r4 c3d3a6a8 r5 c47ec070 r6 00000001 r7 fffffb27
r8 c3b7fbd8 r9 f10182c0 r10 00000000 r11 f1018628
ip 50b1bcf1 sp c47ec050 lr c3b7fcf8 pc c3c2a008

backtrace:
#00 pc 000c6008 /data/app/com.demo.ksk-aiBDkGn3pZ-yJU_8cCthdg==/lib/arm/libsqlcipher.so`

java stacktrace: at java.lang.Runtime.nativeLoad(Native Method) at java.lang.Runtime.loadLibrary0(Runtime.java:1014) at java.lang.System.loadLibrary(System.java:1672) at net.sqlcipher.database.SQLiteDatabase$1.loadLibraries(src:223) at net.sqlcipher.database.SQLiteDatabase.loadLibs(src:240) at net.sqlcipher.database.SQLiteDatabase.loadLibs(src:219) at net.sqlcipher.database.SQLiteDatabase.loadLibs(src:212) at com.demo.ksk.service.dao.DaoCipherInit.(src:42) at com.demo.ksk.service.DaoManager.a(src:71) at com.demo.ksk.service.ConfigManager.a(src:28) at com.demo.ksk.service.ServiceProvider.b(src:47) at com.demo.ksk.manager.Manager.a(src:176) at com.demo.ksk.access.Engine$1.run(src:163) at java.lang.Thread.run(Thread.java:784)

./arm-linux-androideabi-addr2line -C -f -e ~/Downloads/android-database-sqlcipher-4.1.3/jni/armeabi-v7a/libsqlcipher.so 000c6008
std::hashtable<std::pair<int const, unsigned int>, int, std::hash, std::priv::_UnorderedMapTraitsT<std::pair<int const, unsigned int> >, std::priv::_Select1st<std::pair<int const, unsigned int> >, std::equal_to, std::allocator<std::pair<int const, unsigned int> > >::_M_insert_noresize(unsigned int, std::pair<int const, unsigned int> const&)
??:?

I hope to help!

@BlackBirds
Copy link

executed cmd
~/Library/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-objdump -S -D armeabi-v7a/libsqlcipher.so >~/ttt.txt
output is:

28589 1bcf4: eb02a8c3 bl c6008 <ZNSt9hashtableISt4pairIKijEiSt4hashIiENSt4priv20_UnorderedMapTraitsTIS2_EENS5_10_Select1stIS2_EESt8equal_toIiESaIS2_EE18_M_ins ert_noresizeEjRKS2@@base+0x142c8>

@BlackBirds
Copy link

BlackBirds commented Aug 26, 2019

Where can i find the "SYMBOL TABLE" with the aar version 4.1.3?

@mimiks
Copy link

mimiks commented Sep 2, 2019

@developernotes @sjlombardo Have you been able to reproduce this native crash? I could mail you our LG G2 for testing if you like.

@developernotes
Copy link
Member

Hi @mimiks

Would you mind reaching out to us at support@zetetic.net. Since you have a device on hand, we have a beta build of SQLCipher for Android that may address the issue, we would be happy to send it over to test on that device and provide some feedback. Thanks!

@stale
Copy link

stale bot commented Sep 17, 2019

Hello, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug", "enhancement", or "security" and I will leave it open. Thank you for your contributions.

@stale stale bot added the stale This issue lacks recent activity. label Sep 17, 2019
@mimiks
Copy link

mimiks commented Sep 20, 2019

The issue persists.

@stale stale bot removed the stale This issue lacks recent activity. label Sep 20, 2019
@stale
Copy link

stale bot commented Oct 4, 2019

Hello, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug", "enhancement", or "security" and I will leave it open. Thank you for your contributions.

@stale stale bot added the stale This issue lacks recent activity. label Oct 4, 2019
@developernotes developernotes added the bug A software defect within SQLCipher for Android label Oct 4, 2019
@stale stale bot removed the stale This issue lacks recent activity. label Oct 4, 2019
@saucompeng
Copy link

saucompeng commented Oct 15, 2019

I have this problem too.

--------- beginning of crash
F/google-breakpad(12463): Microdump skipped (uninteresting)
W/google-breakpad( 9375): ### ### ### ### ### ### ### ### ### ### ### ### ###
W/google-breakpad( 9375): Chrome build fingerprint:
W/google-breakpad( 9375): 71.0.3578.99
W/google-breakpad( 9375): 357809900
W/google-breakpad( 9375): ### ### ### ### ### ### ### ### ### ### ### ### ###
F/libc ( 9375): Fatal signal 4 (SIGILL), code 1, fault addr 0xaf1e2168 in tid 9375 (###)
I/DEBUG ( 333): [2019-10-15 15:59:12.587]
I/DEBUG ( 333): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 333): Build fingerprint: 'lge/g2_open_ame/g2:5.0.2/LRX22G/153102016bd82:user/release-keys'
I/DEBUG ( 333): Revision: '10'
I/DEBUG ( 333): ABI: 'arm'
I/DEBUG ( 333): pid: 9375, tid: 9375, name: ###### >>> com.###### <<<
I/DEBUG ( 333): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xaf1e2168
W/NativeCrashListener( 962): Couldn't find ProcessRecord for pid 1530015793
I/DEBUG ( 333): r0 00000002 r1 00000000 r2 00000000 r3 af2f97a8
E/DEBUG ( 333): AM write failure (32 / Broken pipe)
I/DEBUG ( 333): r4 00000000 r5 910f4c10 r6 910f4c10 r7 9b22e100
I/DEBUG ( 333): r8 00000050 r9 00000010 sl 00001000 fp a9b1f008
I/DEBUG ( 333): ip af2f543c sp be900898 lr af1dc038 pc af1e2168 cpsr 200d0010
I/DEBUG ( 333):
I/DEBUG ( 333): backtrace:
I/DEBUG ( 333): #00 pc 000f1168 /data/app/######/lib/arm/libsqlcipher.so (_armv7_tick)

@developernotes
Copy link
Member

Hi @saucompeng,

What device and Android OS version are you experiencing this issue on?

@saucompeng
Copy link

LG G2, Android 5.0.2

@developernotes
Copy link
Member

Thanks @saucompeng, would you also check what model variant you have?

@saucompeng
Copy link

@developernotes LG-D802

@saucompeng
Copy link

@developernotes Will you publish any patch? If you send any test tool, I can report data for you.

@developernotes
Copy link
Member

@saucompeng we are in the process of acquiring an LG G2 D802 model for local testing. Thank you for the offer of testing, we may reach out.

@sirekanyan
Copy link

@developernotes any news?

@developernotes
Copy link
Member

Hello @sirekanyan, @KSKjust,

Through our review of this situation, we have identified an issue that appears only on certain devices, mainly those targeting the armeabi-v7a ABI and a limited set of Android operating systems. This issue is specific to OpenSSL when assembly optimization enabled. A potential workaround to address this is to disable assembly optimization when building OpenSSL, however, that would introduce a significant performance impact on devices who are not impacted by this issue.

@anshulkabramobisy
Copy link

Hello @sirekanyan, @KSKjust,

Through our review of this situation, we have identified an issue that appears only on certain devices, mainly those targeting the armeabi-v7a ABI and a limited set of Android operating systems. This issue is specific to OpenSSL when assembly optimization enabled. A potential workaround to address this is to disable assembly optimization when building OpenSSL, however, that would introduce a significant performance impact on devices who are not impacted by this issue.

why this issue was not happening in "sqlcipher:3.5.9@aar" and started occurring in "sqlcipher:4.3.0@aar"?

Do we have any alternate solution for this? in our latest release we have upgraded this library and has impacted thousands of user in India( Oppo Model A37, OS- 5.1) devices is highly used )

Please share some work around solution.

@developernotes
Copy link
Member

Hi @anshulkabramobisy

We provided a recommendation to address the issue for users experiencing this issue above. If your organization is looking for a turnkey solution, please feel free to reach out at support@zetetic.net to discuss options.

@yot940
Copy link

yot940 commented Dec 10, 2020

Hello @developernotes

We also have the same problem above.
According to your investigation the issue appears only on a limited set of Android operating systems.
Could you tell us the details?
If It only happens on Android 5.1 or lower, we'd like to modify minSdkVersion to 23 to avoid this native crash.

@developernotes
Copy link
Member

Hello @yot940

You can find the public information we have shared here. If you organization is looking for a turnkey solution, please feel free to reach out to us at support@zetetic.net. Thanks!

@sqlcipher sqlcipher locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug A software defect within SQLCipher for Android
Projects
None yet
Development

No branches or pull requests

9 participants