mirror of
https://github.com/Lakr233/vphone-cli.git
synced 2026-04-05 04:59:05 +08:00
Prefix research patch comparison doc and normalize root markdown names Rename research root markdown files to scoped topic names
2.4 KiB
2.4 KiB
CFW JB-1 patch-launchd-jetsam
How the patch works
- Source:
scripts/patchers/cfw_patch_jetsam.py. - Locator strategy:
- Find one of these anchor strings in launchd:
jetsam property category (Daemon) is not initializedjetsam property categoryinitproc exited -- exit reason namespace 7 subcode 0x1
- Resolve enclosing C-string start and locate
ADRP+ADDcode xref in__TEXT,__text. - Scan backward (
0x300bytes window) for conditional branch whose target block containsret/retab. - Rewrite selected conditional branch to unconditional
b <same_target>.
- Find one of these anchor strings in launchd:
- Patch action:
- keystone compile with absolute address context:
asm_at("b #<target>", patch_off).
- keystone compile with absolute address context:
Source Code Trace (Scanner)
- Entrypoint:
scripts/patchers/cfw.py-> commandpatch-launchd-jetsam- dispatches to
patch_launchd_jetsam(filepath)
- Method path:
parse_macho_sections()+find_section("__TEXT,__text")_find_cstring_start()on matched anchor_find_adrp_add_ref()to locate string-use site in code- backward scan over conditionals (
b.*,cbz/cbnz/tbz/tbnz) _is_return_block()filter (target block must containret/retab)asm_at("b #target", patch_off)and binary overwrite
Validation Evidence (current workspace)
- Install pipeline wiring confirmed:
scripts/cfw_install_jb.shJB-1 stage calls:inject-dylib ... /cores/launchdhook.dylibpatch-launchd-jetsam ...
scripts/cfw_install_dev.shalso callspatch-launchd-jetsam.
git logfor patch module:- only refactor-origin commit history (
3bcb189), no dedicated bug-fix trail for this patch logic.
- only refactor-origin commit history (
- Local replay limitation:
- workspace currently has no extracted iOS launchd sample binary/log artifact for deterministic offline replay.
Risk Assessment
- Current algorithm is fully dynamic and avoids hardcoded offsets.
- But branch selection is still broad (backward window + earliest matching conditional to return block).
- Without binary-level replay evidence on current target launchd, there is residual false-hit risk.
Status
- Still unproven (possible working, possible mis-hit) under strict confidence gate.
Next Verification Step
- Obtain one actual
/mnt1/sbin/launchd.baksample from current target build and capture:- before/after patch disassembly around
patch_off - matched anchor string VA + xref VA
- final branch target basic block (
ret/retab) confirmation.
- before/after patch disassembly around