Skip to content

feat(zygisk): support GrapheneOS secure app spawning - #34

Merged
pixincreate merged 8 commits into
masterfrom
fix/grapheneos-exec-spawn-zygisk
Aug 14, 2026
Merged

feat(zygisk): support GrapheneOS secure app spawning#34
pixincreate merged 8 commits into
masterfrom
fix/grapheneos-exec-spawn-zygisk

Conversation

@pixincreate

Copy link
Copy Markdown
Owner

Summary

  • detect GrapheneOS Android 17 exec-spawn command replay using the Zygote feature flags and replay-only FD shape
  • specialize the replayed app in place instead of creating an extra Magisk pre-fork parent
  • preserve Zygisk module callbacks and FD containment while returning GrapheneOS' original PID
  • add host-side regression coverage for replay detection, generated hook scope, and no-fork FD lifecycle

Addresses #30 and #32.

Validation

  • python3 native/src/core/zygisk/test_grapheneos_exec_spawn.py (3 tests pass)
  • generated jni_hooks.hpp is deterministic and matches gen_jni_hooks.py
  • git diff --check master...HEAD
  • five-lane implementation review passed after adding baseline FD snapshot/sanitization around module callbacks

Build limitation

The normal native build cannot start because the existing scripts/env.py:95 contains an invalid nested-quote f-string. This PR does not modify that unrelated tooling bug. Device-level acceptance on GrapheneOS is still required.

@pixincreate
pixincreate force-pushed the fix/grapheneos-exec-spawn-zygisk branch from 380caf0 to e251a34 Compare July 15, 2026 19:28
@pixincreate
pixincreate force-pushed the fix/grapheneos-exec-spawn-zygisk branch from 5323819 to 49a3728 Compare July 25, 2026 15:50
@pixincreate
pixincreate force-pushed the fix/grapheneos-exec-spawn-zygisk branch from 49a3728 to 700bf4c Compare July 29, 2026 09:01
@github-actions
github-actions Bot force-pushed the master branch 2 times, most recently from b859b9d to c601cd4 Compare August 4, 2026 08:00
@pixincreate
pixincreate force-pushed the fix/grapheneos-exec-spawn-zygisk branch from 700bf4c to 5ee7098 Compare August 7, 2026 10:10
@pixincreate pixincreate self-assigned this Aug 7, 2026
@pixincreate pixincreate added enhancement New feature or request bug Something isn't working labels Aug 7, 2026
@pixincreate
pixincreate force-pushed the fix/grapheneos-exec-spawn-zygisk branch from 42caa73 to f28a824 Compare August 12, 2026 16:43
Add ZLOGI diagnostics at every critical point in the Zygisk bootstrap
chain to identify why RegisterNatives fails for all JNI hook variants
on GrapheneOS 17 (Android 17, SDK 37).

Logging added at:
- hook_plt(): CommitHook success/failure
- dlclose hook: when it fires and with what handle
- post_native_bridge_load(): runtime_callbacks pointer validity,
  native bridge reload path
- register_jni_methods(): RegisterNatives return code + exception
  status for EACH variant (name + signature logged)
- hook_jni_methods(): enumerate old_methods with signatures+fnPtrs,
  log hook_count, log each successful HOOKED match
- hook_zygote_jni(): enumerate all Zygote native methods with
  signatures, log each name match (kForkApp/kSpecializeApp/
  kForkServer), log final success/failure summary

This is diagnostic only - no behavior changes. All logs are tagged
with 'diag:' prefix for easy grep.
LOGD is compiled out in release builds (MAGISK_DEBUG=0), so the
replay predicate and in-place markers were invisible in tester logs.
Use LOGI so the markers survive release artifacts.
@pixincreate
pixincreate force-pushed the fix/grapheneos-exec-spawn-zygisk branch from f28a824 to 1da659e Compare August 13, 2026 08:24
Runtime validation on Pixel Tablet / GrapheneOS 17 with secure app spawning enabled confirmed the replay path fires and completes (diag: replay true flags=0 fds=[-1,-1], in_place_pre entry, in_place_post specialized=true, no crashes). Strip the temporary instrumentation inserted to trace hook registration and the in-place replay branch so production builds don't spam logcat at INFO level on every GrapheneOS app launch.
@pixincreate pixincreate changed the title Handle GrapheneOS exec-spawn replay in Zygisk feat(zygisk): support GrapheneOS secure app spawning Aug 14, 2026
@pixincreate
pixincreate merged commit 9fcc2dd into master Aug 14, 2026
25 checks passed
@pixincreate
pixincreate deleted the fix/grapheneos-exec-spawn-zygisk branch August 14, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant