zygisk: make built-in Zygisk work on Meta Quest (lazy per-trust partition zygotes) - #9968
Open
xAstroBoy wants to merge 3 commits into
Open
zygisk: make built-in Zygisk work on Meta Quest (lazy per-trust partition zygotes)#9968xAstroBoy wants to merge 3 commits into
xAstroBoy wants to merge 3 commits into
Conversation
This comment was marked as spam.
This comment was marked as spam.
Collaborator
|
This should be under a prop to only not restore it for affecting devices (to prevent detection). Push x pop one should be under another commit. The reason we need it is that we are not in JNI frames in hooking context. |
vvb2060
force-pushed
the
meta-quest-zygisk-fix
branch
from
July 29, 2026 07:02
e64ff0c to
fb50a16
Compare
osm0sis
force-pushed
the
meta-quest-zygisk-fix
branch
from
August 15, 2026 11:13
011262e to
ef099a7
Compare
…tion zygotes) Meta Quest (Horizon OS) does not start the zygote the normal way: ro.zygote= zygote64_stub32 launches /system/bin/stub_zygote, which forks a separate app_process64 zygote PER security partition (system/trusted vs untrusted-app), driven by hzos_security_zygote_partitioning_policy. The untrusted-app partition zygote -- the one that forks 3rd-party apps and the Magisk manager -- is spawned LAZILY, after boot-complete. magiskd sets ro.dalvik.vm.native.bridge=libzygisk.so during boot but clears it again at boot-complete (ZygiskState::reset). On a normal device every zygote has already started by then, so clearing it is harmless. On Quest the untrusted-app partition zygote reads the (now cleared) property when it finally execve's app_process64, never loads libzygisk.so, so 3rd-party apps + the Magisk manager are never injected -> "Zygisk: N/A". Fix (daemon.rs): on the boot-complete reset(restore=true) path, reset the crash counter but KEEP native.bridge set (set_prop) instead of clearing it (restore_prop); only the >3-crash rollback path still clears. The lazily-spawned partition zygotes then load the loader when they start. Also (hook.cpp), robustness fixes the loader needs on this device: - Wrap hook_zygote_jni()'s JNI locals in PushLocalFrame(64)/PopLocalFrame so leaking locals can't trip ART's "non-empty local reference table" abort, and bail if GetEnv returns no env. - Make the strdup(ZygoteInit) trigger a substring match + add an idempotency guard so the zygote hooks install exactly once per process. Verified on Quest 3 (Android 14): system_server + every app fork is intercepted and LSPosed loads end-to-end.
osm0sis
force-pushed
the
meta-quest-zygisk-fix
branch
from
August 19, 2026 02:07
92e7281 to
de95686
Compare
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.
Fixes #9940.
Problem
Built-in Zygisk never becomes active on Meta Quest (Horizon OS): the app shows Zygisk: N/A and Zygisk modules (e.g. LSPosed) don't load. Most Quest users flash NeoZygisk (ptrace) as a workaround — but built-in Zygisk can work with a small change.
Root cause
Quest doesn't start the zygote the normal way:
ro.zygote = zygote64_stub32; init starts/system/bin/stub_zygote(Meta's "zygote partitioning" launcher), whichfork()+execve()s a separateapp_process64zygote per security partition (system/trusted vs untrusted-app), driven by…hzos_security_zygote_partitioning_policy=untrusted_app.magiskd sets
ro.dalvik.vm.native.bridge=libzygisk.soduring boot, but at boot-complete it clears it again (ZygiskState::reset). On a normal device every zygote has already started by then, so clearing it is harmless. On Quest the untrusted-app partition zygote reads the (now-cleared) property when it finallyexecvesapp_process64, never loadslibzygisk.so, and 3rd-party apps + the Magisk manager are never injected → Zygisk: N/A. (The trusted partition, spawned during boot, does get injected.)Fix
daemon.rs— on the boot-completereset(restore=true)path, reset the crash counter but keepnative.bridgeset (set_prop) instead of clearing it (restore_prop); only the >3-crash rollback path still clears. The lazily-spawned partition zygotes then load the loader when they start.hook.cpp— two robustness fixes the loader needs on this device:hook_zygote_jni()'s JNI locals inPushLocalFrame(64)/PopLocalFrame(and bail ifGetEnvreturns no env) so leaking locals can't trip ART'sCheck failed: … non-empty local reference tableabort.strdup(ZygoteInit)trigger a substring match + add an idempotency guard so the zygote hooks install exactly once per process.Verified
On Quest 3 (Android 14):
system_server+ every app fork is now intercepted (nativeForkAndSpecialize/nativeSpecializeAppProcess), and LSPosed loads end-to-end (itslspddaemon runs). The Magisk app shows Zygisk: Yes.Happy to adjust — the two
hook.cppitems may be cheap insurance rather than strictly required on a clean stock build, but they made the loader robust on Quest.Supersedes #9941 — resubmitted after an account migration; branch and commits are identical.