Skip to content

fix(install): DPI daemon init + reliability — fixes the FW-10.40 helper crash (#152)#181

Merged
phantomptr merged 1 commit into
mainfrom
fix/dpi-daemon-init-and-install-reliability
Jul 6, 2026
Merged

fix(install): DPI daemon init + reliability — fixes the FW-10.40 helper crash (#152)#181
phantomptr merged 1 commit into
mainfrom
fix/dpi-daemon-init-and-install-reliability

Conversation

@phantomptr

Copy link
Copy Markdown
Owner

Description

Implements the elf-arsenal gap-analysis fixes for the install-crash + reliability reports (#152, #164, #81), hardware-verified on a real FW 9.60 PS5. Builds on another model's implementation — I reviewed, gated, fixed the CI-breakers, and verified on hardware.

The #152 root cause (fixed)

The standalone DPI daemon called sceAppInstUtilInstallByPackage cold — no sceAppInstUtilInitialize first — which wedged Sony's IPMI state and let the watchdog kill the on-console helper ~4 s after a rejected patch install. That's the "helper dies 4–7 s after the install is rejected" symptom.

Changes

Payload (ezremote_dpi.c): 25 s boot-timing wait (kstuff patches land first) → timed sceAppInstUtilInitialize (10 s timeout, detached thread) + per-request init-retry → never a cold InstallByPackage. Plus path-safety (.. reject) + /data//user/data/ rewrite for the sandboxed installer, and a tri-state ok/error:0x%08X/error:init:…/error:badpath reply (back-compat with the old decimal form).

Engine (pkg_install.rs): parse_dpi_reply (8 unit tests, incl. high-bit-u32 overflow + legacy-decimal), delete_staging_with_retry on the fs_delete_failed token (Sony briefly holds the pkg open post-install; pure predicate + 5 tests), and /api/pkg/dpi-direct-install (streaming install beta, #81 — no staging upload).

Client: "Stream (beta)" install affordance + installStream/runDpiDirectInstall, and an AppShell transfer-port (:9113) liveness probe that logs the "mgmt up but transfer dead" wedge transition — read-only diagnostic, does NOT auto-reconnect (a real crash isn't papered over).

🔬 Hardware verification (FW 9.60 Pro)

  • New DPI daemon loads + binds :9040 without hanging.
  • Path traversal → error:badpath; well-formed nonexistent path → error:0x80020002 (it initialized, called InstallByPackage, got Sony's real reject — not the cold-call wedge).
  • CRUX: the main helper stayed alive + ucred_elevated 6 s after the rejected install — the original Pkg files can’t be updated #152 bundle showed helper death ~4 s after exactly this.

What I fixed on top of the base work

A cy33bccy33hc credit typo and 22 rustfmt violations in pkg_install.rs that would have failed CI.

Not in scope (documented in docs/elf-arsenal-reference-fixes.md)

FW-11+ credential escalation (jb_escalate_pid) — the daemon relies on elfldr's pristine ucred, install-capable only below FW 11 (bgft.c:505); fan-threshold persistence + NP/offline accounts (feature requests).

Testing

Payload + DPI -Werror; engine fmt/clippy/78 tests; desktop 89 tests/clippy; client typecheck/lint/770 tests; i18n 18 langs. Plus the hardware verification above.

Related: #152, #164, #81 (needs a FW 10.40/12.x reporter to confirm end-to-end on their console — the mechanism is verified on 9.60).

🤖 Generated with Claude Code

…er crash (#152, #164, #81)

Implements the elf-arsenal gap-analysis fixes for the install-crash and
reliability reports, HARDWARE-VERIFIED on a real FW 9.60 PS5. The headline
fix is the #152 root cause: the standalone DPI daemon called
sceAppInstUtilInstallByPackage COLD (no sceAppInstUtilInitialize), which
wedged Sony's IPMI state and let the watchdog kill the on-console helper
~4 s after a rejected patch install.

Payload (payload/dpi/ezremote_dpi.c):
- Boot-timing wait (25 s, 500 ms steps) so kstuff's kernel patches land
  before touching AppInstUtil.
- Timed sceAppInstUtilInitialize on a detached thread (10 s timeout) +
  per-request init-retry. Never calls InstallByPackage cold.
- Path safety (reject `..`, non-absolute) + /data/ -> /user/data/ rewrite
  so the sandboxed installer can see the staged pkg.
- Tri-state ok / error:0x%08X / error:init:... / error:badpath / error:recv
  reply (backward-compatible with the old decimal form).

Engine (pkg_install.rs):
- parse_dpi_reply — parses the daemon's tri-state (8 unit tests, incl. the
  high-bit-u32 overflow case and legacy-decimal back-compat).
- delete_staging_with_retry — bounded retry on the bare `fs_delete_failed`
  token (Sony briefly holds the staged pkg open post-install); pure
  is_retryable_delete_error predicate (5 unit tests). Applied at all three
  staging-cleanup sites.
- /api/pkg/dpi-direct-install — streaming install (beta, #81): serve the
  pkg at /pkg-host/ and hand the daemon the HTTP URL, no staging upload.

Client:
- InstallPackage "Stream (beta)" affordance + pkgLibrary installStream /
  runDpiDirectInstall (routes through browserInvoke for the webui too).
- AppShell transfer-port (:9113) liveness probe: logs the up->down
  transition of the "mgmt up but transfer dead" wedge (read-only
  diagnostic — does NOT auto-reconnect, so a real crash isn't papered
  over). connection.ts carries transferAlive.

HARDWARE VERIFICATION (FW 9.60 Pro @192.168.86.100):
- New DPI daemon loads + binds :9040 without hanging.
- Path traversal -> `error:badpath`; well-formed nonexistent path ->
  `error:0x80020002` (it INITIALIZED, called InstallByPackage, got Sony's
  real reject — not the cold-call wedge).
- CRUX: the main helper stayed ALIVE + ucred_elevated 6 s after the
  rejected install (the original #152 bundle showed helper death ~4 s
  after exactly this).

Reviewed + gated by me on top of another model's implementation: fixed a
`cy33bc`->`cy33hc` credit typo and 22 rustfmt violations in pkg_install.rs
that would have failed CI. Full non-HW gate green: payload+DPI -Werror,
engine fmt/clippy/78 tests, desktop 89 tests/clippy, client
typecheck/lint/770 tests, i18n 18 langs.

NOT in scope (documented follow-ups in docs/elf-arsenal-reference-fixes.md):
the FW-11+ credential escalation (jb_escalate_pid) — the DPI daemon relies
on elfldr's pristine ucred, which is install-capable only below FW 11
(bgft.c:505); fan-threshold persistence (P2-7) and NP/offline accounts
(P2-8) feature requests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@phantomptr phantomptr merged commit 59755b7 into main Jul 6, 2026
23 checks passed
@phantomptr phantomptr deleted the fix/dpi-daemon-init-and-install-reliability branch July 6, 2026 09:09
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