Skip to content

fix: payload ptrace/mount/symlink hardening + SDK version docs + install-all trim#173

Merged
phantomptr merged 2 commits into
mainfrom
fix/scan-ptrace-mount-symlink-sdk-docs
Jul 6, 2026
Merged

fix: payload ptrace/mount/symlink hardening + SDK version docs + install-all trim#173
phantomptr merged 2 commits into
mainfrom
fix/scan-ptrace-mount-symlink-sdk-docs

Conversation

@phantomptr

Copy link
Copy Markdown
Owner

Description

Fixes found during a full-repo scan (payload C, Rust engine, TS client, docs/scripts). All are defensive/failure-path changes plus a docs correction and a WIP trim — no success-path behavior changes.

Changes

Payload — ShellUI RPC ptrace hardening (payload/src/ptrace_remote.c). Candidate root cause for the FW-12 install crash where the on-console helper goes unreachable after a rejected install (see #152, #164, #81):

  • pt_mmap: a failed remote mmap returns -errno in rax, but callers only checked ==-1 || ==0 — so -ENOMEM (0xFFFF…F4) was used as a valid pointer and dereferenced inside SceShellUI → crash. Now collapses the whole [-4095,-1] range to -1 in one place.
  • pt_syscall: restores bak_reg on the pt_step/pt_getregs failure paths (mirroring pt_call), so a later PT_DETACH can't resume ShellUI at the syscall site with junk argument registers.
  • pt_attach: PT_DETACH on waitpid failure so a mid-attach EINTR can't leave ShellUI frozen with our tracer leaked.

Payload — FS_MOUNT + reconcile (payload/src/runtime.c):

  • Validate the derived mount_name too, and reject a lone . — otherwise mount_name="." (or an image named ..exfat) builds /mnt/ps5upload/. which the kernel normalises to the namespace root, shadowing every existing mount.
  • Bump reconcile's src[256]src[512] to match the writer / find-existing buffers (long source paths were truncated → false "source missing" at boot).

Payload — sce_sys staging symlink safety (payload/src/register.c): copy_dir_recursive uses lstat() instead of stat(), so a symlink is skipped (as the existing comment already claims) rather than followed — a hostile dump's sce_sys/leak -> /system_data/... no longer copies a system file into user space, and a dangling link no longer aborts the whole copy.

Client — install-all WIP trim (client/src/state/pkgLibrary.ts): removes an unfinished installAll/installingAll that was declared on the store interface without an implementation (TypeScript TS2739 → CI red) plus an orphaned pkgEntryInstallOrder helper. Keeps the standalone-good failure-notification bell so a failed install rings the bell instead of only updating the row (partially addresses #137).

Docs — SDK version (README.md, FAQ.md, scripts/install-{macos,ubuntu,windows}): bump pinned PS5 Payload SDK v0.38 → v0.40 to match CI/release (publish.yml, engine-ci.yml). v0.38 predates getloadavg(), so make install && make payload against it failed to link. The historical CHANGELOG 2.12.1 entry is left untouched.

Type of Change

  • Bug fix (non-breaking)
  • Documentation update

Testing

  • Payload builds clean with -Wall -Wextra -Werror against SDK v0.40.
  • Client: typecheck, lint, 754 Vitest tests, i18n coverage (18 langs) all pass.
  • The three ptrace fixes are failure-path-only, so they don't change success-path behavior on tested firmware (FW 5.10 / 9.60). The FW-12 crash candidate needs FW-12 hardware to confirm end-to-end.

🤖 Generated with Claude Code

phantomptr and others added 2 commits July 5, 2026 16:54
…rsion docs

Findings from a full-repo scan. Client + payload + docs; all gates green
(payload -Werror build, client typecheck/lint/754 tests, i18n 18-lang).

payload/src/ptrace_remote.c — three failure-path hardening fixes on the
ShellUI RPC primitives (candidate root cause for the FW-12 install crash
where the helper goes unreachable after a rejected install):
  - pt_mmap: a failed remote mmap returns -errno in rax; callers only
    checked ==-1||==0, so e.g. -ENOMEM (0xFFFF...F4) was used as a valid
    pointer and dereferenced inside SceShellUI -> crash. Collapse the whole
    [-4095,-1] range to -1 in one place so every caller is covered.
  - pt_syscall: restore bak_reg on the pt_step/pt_getregs failure paths
    (mirroring pt_call), so a later PT_DETACH can't resume ShellUI at the
    syscall site with junk argument registers.
  - pt_attach: PT_DETACH on waitpid failure so a mid-attach EINTR can't
    leave ShellUI frozen + our tracer leaked (next attach would EBUSY).

payload/src/runtime.c — FS_MOUNT: validate the derived mount_name too, and
reject a lone "." — otherwise mount_name "." (or an image named "..exfat")
builds /mnt/ps5upload/. which the kernel normalises to the namespace root,
shadowing every existing mount. Also bump reconcile's src[256] -> src[512]
to match the writer/find-existing buffers (long source paths were truncated
-> false "source missing" at boot).

payload/src/register.c — copy_dir_recursive: lstat() instead of stat() when
staging sce_sys, so a symlink is skipped (as the comment already claims)
rather than followed — a hostile dump's sce_sys/leak -> /system_data/... no
longer copies a system file into user space, and a dangling link no longer
aborts the whole copy.

client/src/state/pkgLibrary.ts — trim an unfinished installAll WIP that
declared installAll/installingAll on the store interface without
implementing them (TypeScript TS2739 -> CI red) and an orphaned
pkgEntryInstallOrder helper. Keep the standalone-good failure-notification
bell so a failed install rings the bell instead of only updating the row.

README.md, FAQ.md, scripts/install-{macos,ubuntu,windows} — bump the pinned
PS5 Payload SDK from v0.38 -> v0.40 to match CI/release (publish.yml,
engine-ci.yml). v0.38 predates getloadavg(); make install && make payload
against it failed to link (undefined symbol: getloadavg). The historical
CHANGELOG 2.12.1 entry documenting the original v0.38->v0.39 bump is left
untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
#171 was admin-merged without CI, so its webui.rs landed with formatting
that cargo fmt --check rejects — blocking the engine job for every
subsequent PR. cargo fmt --all touches the whole workspace regardless of
feature gates, so this surfaced on the first post-#171 CI run. No behavior
change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@phantomptr phantomptr merged commit a9fe56d into main Jul 6, 2026
23 checks passed
@phantomptr phantomptr deleted the fix/scan-ptrace-mount-symlink-sdk-docs branch July 6, 2026 00:06
phantomptr added a commit that referenced this pull request Jul 6, 2026
…n order (#174)

Implements #137's install-all request (and completes the WIP trimmed in
#173). The Install Package screen gains an "Install all (N)" header button
that installs every staged, not-yet-installed package sequentially through
the existing readiness-gated install() cascade, in base -> update -> DLC
order so an add-on never installs before its base (Sony's installer accepts
an update/DLC whose base isn't present yet but then lands nothing).

- pkgLibrary.ts: `pkgEntryInstallOrder` (mirrors uploadQueue.installOrderPriority
  for a PkgEntry) + `installAll` action + `installingAll` state. installAll
  snapshots the idle, not-installed rows, sorts by order, and awaits each
  install() (which self-serializes on `installing` and never throws), counting
  outcomes; one summary bell at the end. No-op if an install is already running.
- InstallPackage screen: "Install all (N)" button, shown only when >1 row is
  installable (a single row already has its own Install button), disabled while
  any install runs.
- pkgLibrary.test.ts: 5 cases pinning pkgEntryInstallOrder (category order,
  path-hint fallback, category-beats-path, batch sort).
- en.ts + i18n-known-missing.json: two new keys, allowlisted for all 17
  non-English locales per the coverage gate.

Client-only; no payload/engine changes. typecheck + lint + 759 tests + i18n
(18 langs) + vite build all green.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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