feat(libSceNpGameIntent): recover sceNpAppLauncherLaunchApp validation #10573

Merged
akkadbakkad89 merged 2 commits from upstream-pr/10573 into main 2026-10-26 21:54:32 +00:00
akkadbakkad89 commented 2026-10-24 10:36:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-24T10:36:16Z.


What

Recovers sceNpAppLauncherLaunchApp (NID GbayQ7DO8jA, exported by libSceNpGameIntent on 4.03 firmware) from a decrypted libSceNpGameIntent.sprx: signature (int32_t, const char*, const char*), 0x80553A02 while the app launcher is uninitialized, 0x80553A04 when the second argument is null/empty or the optional third argument exceeds 0x2000 bytes (strnlen(0x2001) bound in firmware). sceNpAppLauncherInitialize/sceNpAppLauncherTerminate now track the flag that gate checks. The launch itself still throws: firmware tail-calls an internal launch through an extra context and remaps 0x805538xx errors into 0x80553Axx; recorded in docs/dev/debt/libSceNpGameIntent.md.

Tested

Windows 11 MinGW build: libSceNpGameIntent.prx compiles and links. Validation disassembled from libSceNpGameIntent.sprx (firmware 4.03, function at 0x910): init guard byte, test rdx,rdx/cmovne default-string select for arg3, test rsi,rsi + cmp byte [r14],0 empty-string rejection for arg2, strnlen(arg3,0x2001)==0x2001 length bound, error remap 0x80553802->0x80553A02, 0x80553803->0x80553A03, 0x80553804->0x80553A04, other nonzero->0x80553A00. sceNpAppLauncherLaunchApp is imported by PPSA20397 (Assassin's Creed Shadows) from libSceNpGameIntent.prx; no GameIntent guest test exists upstream (the library has no CMakeLists/test target).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA20397 (imports GbayQ7DO8jA from libSceNpGameIntent)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4994665356 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10573). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-24T10:36:16Z. --- ### What Recovers `sceNpAppLauncherLaunchApp` (NID `GbayQ7DO8jA`, exported by `libSceNpGameIntent` on 4.03 firmware) from a decrypted `libSceNpGameIntent.sprx`: signature `(int32_t, const char*, const char*)`, `0x80553A02` while the app launcher is uninitialized, `0x80553A04` when the second argument is null/empty or the optional third argument exceeds 0x2000 bytes (`strnlen(0x2001)` bound in firmware). `sceNpAppLauncherInitialize`/`sceNpAppLauncherTerminate` now track the flag that gate checks. The launch itself still throws: firmware tail-calls an internal launch through an extra context and remaps `0x805538xx` errors into `0x80553Axx`; recorded in `docs/dev/debt/libSceNpGameIntent.md`. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 MinGW build: `libSceNpGameIntent.prx` compiles and links. Validation disassembled from `libSceNpGameIntent.sprx` (firmware 4.03, function at 0x910): init guard byte, `test rdx,rdx`/`cmovne` default-string select for arg3, `test rsi,rsi` + `cmp byte [r14],0` empty-string rejection for arg2, `strnlen(arg3,0x2001)==0x2001` length bound, error remap `0x80553802->0x80553A02`, `0x80553803->0x80553A03`, `0x80553804->0x80553A04`, other nonzero->`0x80553A00`. `sceNpAppLauncherLaunchApp` is imported by PPSA20397 (Assassin's Creed Shadows) from `libSceNpGameIntent.prx`; no GameIntent guest test exists upstream (the library has no CMakeLists/test target). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> PPSA20397 (imports `GbayQ7DO8jA` from libSceNpGameIntent) - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-10-24 10:38:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T10:38:27Z.

Review: CHANGES_REQUESTED


There is an unbounded read in the recovered length check. The PR says firmware uses strnlen(arg3, 0x2001), but this implementation calls std::strlen(arg3) and only then compares the result with 0x2000. A non-terminated buffer of 0x2001 bytes can make the host read beyond the firmware’s validation window (or fault while searching for a terminator) instead of returning 0x80553A04. Please use the same bounded check—reject when strnlen(arg3, 0x2001) == 0x2001—and add a regression with a 0x2001-byte non-terminated buffer. Also, AppLauncherInitialized() is a process-global plain bool read and written by exported functions; concurrent initialize/terminate/launch calls create a C++ data race. Please make this state atomic or protect the lifecycle/check with a mutex and cover the intended ordering.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5637950310 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10573#pullrequestreview-5637950310). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T10:38:27Z. **Review:** CHANGES_REQUESTED --- There is an unbounded read in the recovered length check. The PR says firmware uses `strnlen(arg3, 0x2001)`, but this implementation calls `std::strlen(arg3)` and only then compares the result with `0x2000`. A non-terminated buffer of 0x2001 bytes can make the host read beyond the firmware’s validation window (or fault while searching for a terminator) instead of returning `0x80553A04`. Please use the same bounded check—reject when `strnlen(arg3, 0x2001) == 0x2001`—and add a regression with a 0x2001-byte non-terminated buffer. Also, `AppLauncherInitialized()` is a process-global plain `bool` read and written by exported functions; concurrent initialize/terminate/launch calls create a C++ data race. Please make this state atomic or protect the lifecycle/check with a mutex and cover the intended ordering.
MarcZX10 commented 2026-10-24 11:51:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T11:51:38Z.

Review: CHANGES_REQUESTED


The current head still has both issues from my earlier review. The recovered firmware path is strnlen(arg3, 0x2001) == 0x2001, but the implementation calls unbounded std::strlen before checking 0x2000; a non-terminated 0x2001-byte input can read beyond the firmware validation window or fault instead of returning invalid argument. Please use the same bounded check and add a non-terminated 0x2001-byte regression. Also, the plain static bool is concurrently read by LaunchApp and written by Initialize/Terminate, which is a C++ data race. Please use an atomic or synchronization and add coverage for the intended lifecycle concurrency. Hosted structural checks pass, but product/platform jobs are skipped, so the reported Windows compile is the only build evidence currently listed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638138870 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10573#pullrequestreview-5638138870). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T11:51:38Z. **Review:** CHANGES_REQUESTED --- The current head still has both issues from my earlier review. The recovered firmware path is `strnlen(arg3, 0x2001) == 0x2001`, but the implementation calls unbounded `std::strlen` before checking 0x2000; a non-terminated 0x2001-byte input can read beyond the firmware validation window or fault instead of returning invalid argument. Please use the same bounded check and add a non-terminated 0x2001-byte regression. Also, the plain static bool is concurrently read by LaunchApp and written by Initialize/Terminate, which is a C++ data race. Please use an atomic or synchronization and add coverage for the intended lifecycle concurrency. Hosted structural checks pass, but product/platform jobs are skipped, so the reported Windows compile is the only build evidence currently listed.
MarcZX10 commented 2026-10-24 12:21:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:21:36Z.

Review: APPROVED


The revised validation now uses a bounded over the firmware's 0x2001-byte window, and the initialization state is atomic. The new tests cover pre-init/post-terminate behavior, null/empty required input, an unterminated 0x2001-byte buffer, the 0x2000-byte boundary reaching the unimplemented launch path, and concurrent lifecycle calls. I found no remaining blocker in this diff. Hosted eligibility, conventions, labels, and report checks pass; the platform build/test jobs were skipped by the workflow gate, so I have not independently reproduced the contributor-reported Windows test run.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638219216 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10573#pullrequestreview-5638219216). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T12:21:36Z. **Review:** APPROVED --- The revised validation now uses a bounded over the firmware's 0x2001-byte window, and the initialization state is atomic. The new tests cover pre-init/post-terminate behavior, null/empty required input, an unterminated 0x2001-byte buffer, the 0x2000-byte boundary reaching the unimplemented launch path, and concurrent lifecycle calls. I found no remaining blocker in this diff. Hosted eligibility, conventions, labels, and report checks pass; the platform build/test jobs were skipped by the workflow gate, so I have not independently reproduced the contributor-reported Windows test run.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10573
No description provided.