fix(libSceGnmDriver): guard workload output pointers #18212

Merged
DonRyuzaki merged 6 commits from upstream-pr/18212 into main 2026-11-18 19:26:38 +00:00
DonRyuzaki commented 2026-11-10 21:25:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DonRyuzaki on 2026-11-10T21:25:43Z.


What

Current main merged #18235, which already exports the regular GNM workload lifecycle functions. This PR now guards the output pointers in sceGnmCreateWorkloadStream and sceGnmBeginWorkload with GuestCopyOut_nid_no_patch. An invalid guest output address returns the existing code 3 instead of being dereferenced. Valid outputs, stream boundaries, and sceGnmEndWorkload behavior stay as implemented on main. The NeoMode provider already uses GuestCopyOut_nid_no_patch.

The existing guest_gnm_driver test now checks invalid output addresses for both functions, including the invalid-stream path. This is a pointer-safety fix; no new exports are added.

Tested

Head 8c362ff625287d52b6096239da42bd2facce8e40, merged with upstream main 1a4e8ab22c2f050cbaa177480fe98e11d187e9c1. The patch against that main changes only core/libs/prx/libSceGnmDriver/Export.cpp and core/libs/tests/GuestGnmDriver.cpp.

  • Ubuntu 24.04 under WSL2, GCC 13.3, CMake/Ninja Release, bundled dependencies, BUILD_TESTING=ON: cmake --build build --target guest_gnm_driver_tests --parallel 8 passed on the merged tree.
  • ctest --test-dir build --no-tests=error --output-on-failure -R '^guest_gnm_driver$': 1/1 passed on that tree.
  • git diff --check upstream/main HEAD and python3 -B tools/check_conventions.py --base upstream/main: passed on the committed head.
  • Hosted checks on this head are in progress. No game, console, or GPU execution is claimed.

Checklist

  • Based on current main; no other open PR implements this pointer-safety fix
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5249176447 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18212). Originally posted by [DonRyuzaki](https://github.com/DonRyuzaki) on 2026-11-10T21:25:43Z. --- ### What Current main merged [#18235](https://github.com/boykopovar/AnyPS5/pull/18235), which already exports the regular GNM workload lifecycle functions. This PR now guards the output pointers in `sceGnmCreateWorkloadStream` and `sceGnmBeginWorkload` with `GuestCopyOut_nid_no_patch`. An invalid guest output address returns the existing code 3 instead of being dereferenced. Valid outputs, stream boundaries, and `sceGnmEndWorkload` behavior stay as implemented on main. The NeoMode provider already uses `GuestCopyOut_nid_no_patch`. The existing `guest_gnm_driver` test now checks invalid output addresses for both functions, including the invalid-stream path. This is a pointer-safety fix; no new exports are added. ### 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. --> Head `8c362ff625287d52b6096239da42bd2facce8e40`, merged with upstream main `1a4e8ab22c2f050cbaa177480fe98e11d187e9c1`. The patch against that main changes only `core/libs/prx/libSceGnmDriver/Export.cpp` and `core/libs/tests/GuestGnmDriver.cpp`. - Ubuntu 24.04 under WSL2, GCC 13.3, CMake/Ninja Release, bundled dependencies, `BUILD_TESTING=ON`: `cmake --build build --target guest_gnm_driver_tests --parallel 8` passed on the merged tree. - `ctest --test-dir build --no-tests=error --output-on-failure -R '^guest_gnm_driver$'`: 1/1 passed on that tree. - `git diff --check upstream/main HEAD` and `python3 -B tools/check_conventions.py --base upstream/main`: passed on the committed head. - Hosted checks on this head are in progress. No game, console, or GPU execution is claimed. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements this pointer-safety fix - [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) and the licence notice of code adapted from upstream (see AGENTS.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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-12 21:16:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T21:16:02Z.

Review: COMMENTED


Workload lifecycle exports for the regular GNM driver — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head c1d72b98d982407ab3a7649d24cb7bddbce7eaa2, base main.
  • Read the PR description, the commit list, the manifest, and the changed hunks of all six reviewed files in diff.patch. Read the head of core/libs/tests/GuestGnmDriver.cpp (lines 1–30) through the reader.
  • Files read: 6 of 6 reviewed, as diff hunks only. No files were excluded.
  • No build and no test run.
python3 repo_read.py search "5udAm+6boVg"
python3 repo_read.py search "_nid_disambig1"
python3 repo_read.py cat core/libs/tests/GuestGnmDriver.cpp 1 30

Results

Check Result Note
Logic against description passed Helper rules match the stated ones
Neo provider behavior passed Moved bodies are unchanged
Guest test assertions not run Read against the code, not executed
Build and guest tests not run Author-reported only
Hosted CI not run Not checked

Findings

Blocking: none.

Non-blocking: none found in the changed lines.

Not verified

  • The NID values 5udAm+6boVg, ihxrbsoSKWc and Fa3x75OOLRA. The repository has no text match for them, and the NID mapping comes from build tooling that I did not check.
  • The shadPS4 behavior the description cites. I did not fetch it.
  • The build, the guest test runs and the PRX SHA-256 values. They are author-reported and were not run here.
  • Hosted CI on this head.
  • Overlap with open PRs #17393, #17711, #17942, #16882, #16238, #16360 and #6977.
  • Full text at the head of Export.cpp (both providers), Api.hpp, the rest of GuestGnmDriver.cpp and the debt file. I read only the diff hunks of these.
  • Console behavior of the three calls, which the description says is unmeasured.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5882136517 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18212#pullrequestreview-5882136517). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-12T21:16:02Z. **Review:** COMMENTED --- # Workload lifecycle exports for the regular GNM driver — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head `c1d72b98d982407ab3a7649d24cb7bddbce7eaa2`, base `main`. - Read the PR description, the commit list, the manifest, and the changed hunks of all six reviewed files in `diff.patch`. Read the head of `core/libs/tests/GuestGnmDriver.cpp` (lines 1–30) through the reader. - Files read: 6 of 6 reviewed, as diff hunks only. No files were excluded. - No build and no test run. ```sh python3 repo_read.py search "5udAm+6boVg" python3 repo_read.py search "_nid_disambig1" python3 repo_read.py cat core/libs/tests/GuestGnmDriver.cpp 1 30 ``` ## Results | Check | Result | Note | |---|---|---| | Logic against description | passed | Helper rules match the stated ones | | Neo provider behavior | passed | Moved bodies are unchanged | | Guest test assertions | not run | Read against the code, not executed | | Build and guest tests | not run | Author-reported only | | Hosted CI | not run | Not checked | ## Findings **Blocking:** none. **Non-blocking:** none found in the changed lines. ## Not verified - The NID values `5udAm+6boVg`, `ihxrbsoSKWc` and `Fa3x75OOLRA`. The repository has no text match for them, and the NID mapping comes from build tooling that I did not check. - The shadPS4 behavior the description cites. I did not fetch it. - The build, the guest test runs and the PRX SHA-256 values. They are author-reported and were not run here. - Hosted CI on this head. - Overlap with open PRs #17393, #17711, #17942, #16882, #16238, #16360 and #6977. - Full text at the head of `Export.cpp` (both providers), `Api.hpp`, the rest of `GuestGnmDriver.cpp` and the debt file. I read only the diff hunks of these. - Console behavior of the three calls, which the description says is unmeasured. ## To get this to a good state Nothing is required.
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!18212
No description provided.