Skip to content
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

[Android] sqlcipher_mlock: mlock() error logs #48

Open
almozavr opened this issue Aug 29, 2024 · 1 comment
Open

[Android] sqlcipher_mlock: mlock() error logs #48

almozavr opened this issue Aug 29, 2024 · 1 comment

Comments

@almozavr
Copy link

Issue

We see numerous logcat messages:
sqlcipher D sqlcipher_mlock: mlock() returned -1 errno=12

DB itself looks like it works normally.

Env

  • module: "net.zetetic:sqlcipher-android"
  • version: 4.6.0, 4.6.1
  • room: 2.6.1
  • android 14
@developernotes
Copy link
Member

Hi @almozavr,

The output you are now seeing is due to changes in SQLCipher, and likely Android. Logging in SQLCipher was previously disabled, however, starting in SQLCipher 4.6.0 1, both ERROR and WARN log messages will be emitted. With the release of SQLCipher 4.6.1 2, we added the ability to filter log sources via PRAGMA cipher_log_source 3.

With the release of Android 14, the mlock() implementation drastically reduced the maximum allocation size per process from 64 MB down to 64 KB 4. This is likely the culprit that is triggering the errors you are seeing now.

Given this information, if you are using PRAGMA cipher_memory_security = ON;, you may wish to disable that as it will cause all allocations within SQLCipher to attempt memory locking which would further increase the level of error logging you may see. The default for PRAGMA cipher_memory_security is off.

In the future, we plan to investigate whether an alternative memory allocation strategy can minimize memory locking errors.

Footnotes

  1. https://www.zetetic.net/blog/2024/05/21/sqlcipher-4.6.0-release/

  2. https://www.zetetic.net/blog/2024/08/20/sqlcipher-4.6.1-release/

  3. https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_log_source

  4. https://developer.android.com/about/versions/14/behavior-changes-all#mlock

kibibytium added a commit to tutao/tutanota that referenced this issue Jan 29, 2025
mlock is used by sqlcipher but is not allowed on our test containers
see sqlcipher/sqlcipher-android#48 (comment)
see systemd/systemd#9414 (comment)
mpfau pushed a commit to tutao/tutanota that referenced this issue Jan 30, 2025
mlock is used by sqlcipher but is not allowed on our test containers
see sqlcipher/sqlcipher-android#48 (comment)
see systemd/systemd#9414 (comment)
kibibytium added a commit to tutao/tutanota that referenced this issue Jan 31, 2025
mlock is used by sqlcipher but is not allowed on our test containers
see sqlcipher/sqlcipher-android#48 (comment)
see systemd/systemd#9414 (comment)
ganthern pushed a commit to tutao/tutanota that referenced this issue Jan 31, 2025
mlock is used by sqlcipher but is not allowed on our test containers
see sqlcipher/sqlcipher-android#48 (comment)
see systemd/systemd#9414 (comment)
ganthern pushed a commit to tutao/tutanota that referenced this issue Jan 31, 2025
mlock is used by sqlcipher but is not allowed on our test containers
see sqlcipher/sqlcipher-android#48 (comment)
see systemd/systemd#9414 (comment)
tuta-sudipg pushed a commit to tutao/tutanota that referenced this issue Jan 31, 2025
mlock is used by sqlcipher but is not allowed on our test containers
see sqlcipher/sqlcipher-android#48 (comment)
see systemd/systemd#9414 (comment)
tuta-sudipg pushed a commit to tutao/tutanota that referenced this issue Jan 31, 2025
mlock is used by sqlcipher but is not allowed on our test containers
see sqlcipher/sqlcipher-android#48 (comment)
see systemd/systemd#9414 (comment)
tuta-sudipg pushed a commit to tutao/tutanota that referenced this issue Jan 31, 2025
mlock is used by sqlcipher but is not allowed on our test containers
see sqlcipher/sqlcipher-android#48 (comment)
see systemd/systemd#9414 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants