Query Magisk su-policy DB without the bundled 32-bit sqlite3 - #91
Open
Loukious wants to merge 1 commit into
Open
Query Magisk su-policy DB without the bundled 32-bit sqlite3#91Loukious wants to merge 1 commit into
Loukious wants to merge 1 commit into
Conversation
checkMagiskNotification()/disableMagiskNotification() always shelled out
to the sqlite3 binary bundled in assets, which is a 32-bit ARM ELF. On
64-bit-only arm64 devices the kernel refuses to exec it
("not executable: 32-bit ELF file"), so the su-notification check
failed on every app launch.
Route both methods through a new magiskSql() helper with a fallback
chain:
- `magisk --sqlite` (Magisk 20.3+ ships its own frontend, any arch)
- no /data/adb/magisk.db -> return empty (KernelSU and other managers
have no policy DB; don't shell out at all)
- /system/bin/sqlite3 when the ROM ships one
- bundled 32-bit binary as last resort for 32-bit devices
Verified on a KernelSU-Next device (64-bit-only, Android 17): the
probes now resolve to false/false and return immediately, with zero
sqlite3 errors in the debug log DB.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every app launch logs this error (visible in Settings → Debug):
checkMagiskNotification()/disableMagiskNotification()unconditionallyshell out to the sqlite3 binary bundled in assets, which is a 32-bit ARM
ELF. Devices that ship 64-bit-only arm64 builds (no 32-bit ABI support —
increasingly common on new hardware) cannot exec it at all, so the
Magisk su-notification check fails on every launch.
Fix
Both methods now go through a new private
magiskSql(String)helper with afallback chain:
magisk --sqlite "..."— Magisk 20.3+ ships its own sqlite frontend that works on every arch/data/adb/magisk.db? → return empty immediately. KernelSU, KernelSU-Next, APatch and other managers have no Magisk policy DB at all — shelling out can never produce a useful result, so don't/system/bin/sqlite3— some ROMs ship a native sqlite3; prefer it over the bundled binaryVerification
On a 64-bit-only arm64 device (Android 17, KernelSU-Next):
[ -x /data/adb/magisk ]→ false,[ -f /data/adb/magisk.db ]→ false → early return, no sqlite3 exec attemptsqlite3/not executableentries in the debug log DB after relaunch