Skip to content

zygisk: exempt the manager host from DENY_PROCESS_PTRACE on GrapheneOS - #1019

Open
david568303 wants to merge 1 commit into
JingMatrix:masterfrom
david568303:fix/graphene-parasitic-manager
Open

david568303 wants to merge 1 commit into
JingMatrix:masterfrom
david568303:fix/graphene-parasitic-manager

Conversation

@david568303

Copy link
Copy Markdown

The parasitic manager could not launch on GrapheneOS even with the DCL workaround in place: tapping its notification (or the shortcut) aborted the host spawn with

selinux_android_setcontext(2000, 0,
"platform:privapp:targetSdkVersion=36:partition=system:complete",
"org.matrix.vector.manager", grapheneos_flags: "100") failed
-> zygote64 SIGABRT (crash-loop)

grapheneos_flags is SELinuxFlags, printed in hex: 0x100 == 1<<8 == DENY_PROCESS_PTRACE. SELinuxFlags.get() starts from ALL_RESTRICTIONS and only clears DENY_PROCESS_PTRACE when AswDenyNativeDebug returns false, but that switch is immutably true for every system app — and the host, com.android.shell, is a system app. GrapheneDclHooker already forces the three DCL switches off for the host, which is why bits 0..7 are gone and the surviving flag is exactly 0x100. The manager is injected over ptrace (NeoZygisk/Zygisk), so with DENY_PROCESS_PTRACE armed the context transition for the host process fails and the spawn aborts.

Add AswDenyNativeDebug to the set of switches forced off for the manager host (same getImmutableValue override, same host-only guard). That clears DENY_PROCESS_PTRACE for the host alone, so the parasitic manager specializes and the notification opens it — module only, no standalone manager APK required. Every other app keeps GrapheneOS's verdict.

issue #997

The parasitic manager could not launch on GrapheneOS even with the DCL
workaround in place: tapping its notification (or the shortcut) aborted
the host spawn with

  selinux_android_setcontext(2000, 0,
    "platform:privapp:targetSdkVersion=36:partition=system:complete",
    "org.matrix.vector.manager", grapheneos_flags: "100") failed
  -> zygote64 SIGABRT (crash-loop)

grapheneos_flags is SELinuxFlags, printed in hex: 0x100 == 1<<8 ==
DENY_PROCESS_PTRACE. SELinuxFlags.get() starts from ALL_RESTRICTIONS and
only clears DENY_PROCESS_PTRACE when AswDenyNativeDebug returns false,
but that switch is immutably true for every system app — and the host,
com.android.shell, is a system app. GrapheneDclHooker already forces the
three DCL switches off for the host, which is why bits 0..7 are gone and
the surviving flag is exactly 0x100. The manager is injected over ptrace
(NeoZygisk/Zygisk), so with DENY_PROCESS_PTRACE armed the context
transition for the host process fails and the spawn aborts.

Add AswDenyNativeDebug to the set of switches forced off for the manager
host (same getImmutableValue override, same host-only guard). That
clears DENY_PROCESS_PTRACE for the host alone, so the parasitic manager
specializes and the notification opens it — module only, no standalone
manager APK required. Every other app keeps GrapheneOS's verdict.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SNf36vn5z9zfgzzEF5LXRJ
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

Successfully merging this pull request may close these issues.

2 participants