Repository navigation
Conversation
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.
Summary
Adds an opt-in, generic zygote handoff for devices where the App process still has a seccomp filter after W1/W2.
After W1 makes SELinux permissive and W2 obtains temporary root, the victim child can execute a small arm64 PIE helper. The helper attaches to
zygote64, creates a child withclone(SIGCHLD), injectsexecve, and runs the existing root script from that zygote child. The script therefore executes without the App process's seccomp filter.The handoff is selected only when all of the following are true:
recommend_zygoteonly seeds the switch at startup.libzygote_exec.sohelper is executable.Otherwise, the existing W1/W2/W3 flow is unchanged. The existing Shizuku entry is also unchanged. A UserService process with
Seccomp: 0continues to skip W3 and use the direct root-script handoff without invoking zygote.Background
This work started while investigating a PICO 4 Ultra device whose W3 completion was unreliable. The resulting handoff is device-independent and contains no PICO-specific profile, firmware, carrier, or KernelSU changes. The generic path was independently verified on a Xiaomi MIX Fold 3.
Motivation
Some devices complete W1 and W2 but cannot reliably complete W3. Shizuku avoids this problem because its UserService runs as shell without the App seccomp filter, but requiring an external Shizuku process adds a separate setup and authorization dependency.
This change provides another seccomp-free handoff using the platform
zygote64process after temporary root has been obtained. It does not require a device-specific KernelSU build or a modifiedzygoted.Changes
recommend_zygoteprofile field with a default of0.zygote_enabledvalue to the existing PRIV1 v2metasection.recommend_shizuku = 1andrecommend_zygote = 1in the same profile.libzygote_exec.so.No new profile-wire version is introduced. Existing profiles omit the new fields and decode them as
0.Device verification
Device: Xiaomi MIX Fold 3, Android 16, kernel
5.15.194-android13-8-00019-gf4321180a397-ab15212794. Device serial numbers are omitted from the records.Direct zygote handoff
Seccomp=2,Seccomp_filters=1main=3,consumer=4multicast_waiternot_startSeccomp: 0Gate record: ZYGOTE-01
Shizuku compatibility
uid=2000,Seccomp=0Seccomp: 0Gate record: ZYGOTE-02
Both final gates required three attempts because of the repository's documented W1 nondeterminism and
KERNEL-PANIC-01behavior. Attempts that exhaustedprepare_kernel_pageor rebooted during W1 are recorded in the gate documents. The successful runs completed without panic or reboot.Static verification
make -C src native-host-testspassesmake -C src host-attack-dataflow-testpassesmake -C src lsprivilegepasses with NDK 29make -C src zygote-execpasses with zero warningsmake -C src lint-tidypassestools/cmp_disasm.pyreturnsPASS./gradlew exportKernelProfilespasses./gradlew :app:assembleDebugpasses./gradlew :app:assembleReleasepassesliblsprivilege.soandlibzygote_exec.soAll seven commits were checked independently in isolated worktrees. Every commit compiled, and native host and attack dataflow tests passed at every commit.
Android unit-test baseline
The complete Android suite currently reports:
The two remaining failures also reproduce on unmodified upstream:
ExporterAgreementTestProfileMigrationEquivalenceTestThe clean upstream baseline additionally fails
NativeDocumentEquivalenceTest. This PR updates that golden fixture after intentionally adding the two new profile meta fields. No Zygote-specific test failure remains.The upstream
Buildworkflow does not currently runtestDebugUnitTest, so the local results above are included as manual validation evidence.Review notes
Checklist