Prevent jailbreakd deadlock that causes device reboots - #142
Conversation
|
I/no one else has ever encountered this problem before. Can you tell me how to reproduce it? |
|
For me this issue comes from playing Call of Duty Mobile on an iphone 7 with tweaks on. It's somewhat consistent but idk how else to reproduce. When I try to enter "battle royale" game mode, it would freeze at 99%, then my device would stop responding to any touches or button presses, then my device would fully restart. I can't repeat it on other devices and neither can my friends who use roothide. Most likely explanation is how bad the phone is, but regardless it's still a problem. I haven't rebooted once since I integrated this pr into my own build I'm currently using on that iphone 7 |
|
1: 2: |
|
im not sure about the rest but the timing change stopped the reboot for sure, changing it from 90 sec to 10. though it probably masks the real issue. if you want all my logs I'd be happy to send them privately to your email or discord just let me know |
Summary
Prevent a launchd/jailbreakd spawn-patching deadlock that can block the system long enough for watchdogd to force a full device reboot.
Root cause
JBD_MSG_SPAWN_EXEC_STARTandJBD_MSG_SPAWN_EXEC_CANCELcurrently run inline on jailbreakd's receive queue. If exec-patch registration stalls inspawnExecPatchAdd, jailbreakd cannot service a nestedJBD_MSG_SPAWN_PATCH_CHILDrequest from launchd. Launchd waits synchronously for that reply, its event thread stops making progress, and the system watchdog eventually reboots the device.This was diagnosed from repeated full-device watchdog panic stackshots with the same blocking chain:
watchdogd -> launchd event queue -> jailbreakd -> spawnExecPatchAddChanges
JBD_MSG_SPAWN_PATCH_CHILDremains on jailbreakd's receive queue so launchd's nested request can complete while an exec registration is slow.Impact
Without this change, the failure presents as a whole-device reboot rather than an isolated application or daemon crash. The first stage removes the receive-queue cycle; the bounded wait is a defensive fallback that returns failure to the existing launchd-side path, which terminates the still-suspended child and reports spawn error 202.
Validation
libjailbreak,jailbreakd, andsystemhooksuccessfully for arm64 and arm64e with Xcode 26.git diff --checkpasses.