Skip to content

Handle reinjection more safely under KernelSU late-load / soft restart#685

Open
byemaxx wants to merge 3 commits intoJingMatrix:masterfrom
byemaxx:fix-repeated-soft-restart-instability
Open

Handle reinjection more safely under KernelSU late-load / soft restart#685
byemaxx wants to merge 3 commits intoJingMatrix:masterfrom
byemaxx:fix-repeated-soft-restart-instability

Conversation

@byemaxx
Copy link
Copy Markdown

@byemaxx byemaxx commented Apr 19, 2026

I found a stability issue when using the current version under KernelSU late-load (jailbreak) mode, especially after soft restart.

Problem

Multiple surviving daemon instances may still exist after restart, and they can react to the same system_server restart concurrently.

This can lead to:

  • duplicated reinjection attempts
  • duplicated proxy service re-registration
  • duplicated dex2oat wrapper restart
  • unstable framework injection state after soft restart

Proposed solution

This patch adds a simple reinjection coordination mechanism:

  • a single active reinjection owner
  • cross-process reinjection locking
  • stale-owner takeover if the recorded owner is no longer alive

The goal is to make reinjection handling more deterministic under KernelSU late-load / soft restart, and avoid multiple daemon instances racing on the same restart event.
This might not be the best solution, but it solved the problem for now in my tests.

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.

1 participant