fix(audioout2): guard port-state guest output #18044

Merged
DonRyuzaki merged 1 commit from upstream-pr/18044 into main 2026-11-12 07:34:20 +00:00
DonRyuzaki commented 2026-11-10 07:20:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DonRyuzaki on 2026-11-10T07:20:49Z.


What

sceAudioOut2PortGetState previously filled a caller output record through raw stores. It now builds the same complete state locally and copies it to guest memory with GuestCopyOut_nid_no_patch. Valid bytes, invalid-handle precedence and null-pointer behavior remain unchanged. An unwritable non-null output returns the existing invalid-argument code without crashing the host or changing errno. The console result for that pointer remains unmeasured and is recorded as a host-safety fallback.

Rebased onto upstream main 2ecc68bda2642fbd5b4c9fb799bc1da4aa3df191. The documentation conflict with merged #16736 was resolved by retaining its AudioOut2 grain-cap note alongside this PR's guest-output safety note. This PR changes the AudioOut2 port-state export, its focused test and its technical debt entry.

Tested

  • Ubuntu 24.04 WSL2, GCC 13.3, Release, BUILD_TESTING=ON: the regression on unchanged upstream code segfaulted at guest output 0x10 (CTest exit 8). Earlier tested head 9508bc0ee99db2cd09ec55a9c426f044b0e41130 on main 53bb9927828957e110557a9eb710c7ba954f8732 passed the full default Linux runtime build, 3095/3095 Ninja steps; audio_out2_device_state passed three consecutive focused CTest runs. The full CTest suite was not run.
  • Current rebased head fd0d9fa8edc42917b0e97c70985d2b8a61d49537 passes Windows Python 3.12.10 tools/check_conventions.py --base origin/main, git diff --check origin/main...HEAD, and clean-tree checks. Static inspection confirms the C++ source and focused test changes remain the same as the original PR patch, and the debt file retains both notes.
  • On the pinned upstream base 2ecc68bda2642fbd5b4c9fb799bc1da4aa3df191, the rebased libSceAudioOut production target and audio_out2_device_state_tests built under Ubuntu 24.04 WSL2, Release, BUILD_TESTING=ON. The linked library was copied and NID-patched with the project tool. audio_out2_device_state and public_headers each passed three consecutive CTest runs (6/6 runs, no skips). SHA-256: unpatched 4933823f44a05526b6451cb87a76d51ac8cf590eb44586fa9ee4b33793142682; patched f3cf38bab3de741437b3848eccba0b0adfa08ac42d63dc58d8ea34705de33c3a. The full CTest suite was not run.
  • Exact-head GitHub Build (including Windows), Emscripten portability, and Progress report workflows passed. No game or GPU test.

Checklist

  • Based on current main; no other open PR implements this AudioOut2 export
  • 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: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5237425384 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18044). Originally posted by [DonRyuzaki](https://github.com/DonRyuzaki) on 2026-11-10T07:20:49Z. --- ### What `sceAudioOut2PortGetState` previously filled a caller output record through raw stores. It now builds the same complete state locally and copies it to guest memory with `GuestCopyOut_nid_no_patch`. Valid bytes, invalid-handle precedence and null-pointer behavior remain unchanged. An unwritable non-null output returns the existing invalid-argument code without crashing the host or changing `errno`. The console result for that pointer remains unmeasured and is recorded as a host-safety fallback. Rebased onto upstream `main` `2ecc68bda2642fbd5b4c9fb799bc1da4aa3df191`. The documentation conflict with merged #16736 was resolved by retaining its AudioOut2 grain-cap note alongside this PR's guest-output safety note. This PR changes the AudioOut2 port-state export, its focused test and its technical debt entry. ### Tested - Ubuntu 24.04 WSL2, GCC 13.3, Release, `BUILD_TESTING=ON`: the regression on unchanged upstream code segfaulted at guest output `0x10` (CTest exit 8). Earlier tested head `9508bc0ee99db2cd09ec55a9c426f044b0e41130` on `main` `53bb9927828957e110557a9eb710c7ba954f8732` passed the full default Linux runtime build, 3095/3095 Ninja steps; `audio_out2_device_state` passed three consecutive focused CTest runs. The full CTest suite was not run. - Current rebased head `fd0d9fa8edc42917b0e97c70985d2b8a61d49537` passes Windows Python 3.12.10 `tools/check_conventions.py --base origin/main`, `git diff --check origin/main...HEAD`, and clean-tree checks. Static inspection confirms the C++ source and focused test changes remain the same as the original PR patch, and the debt file retains both notes. - On the pinned upstream base `2ecc68bda2642fbd5b4c9fb799bc1da4aa3df191`, the rebased `libSceAudioOut` production target and `audio_out2_device_state_tests` built under Ubuntu 24.04 WSL2, Release, `BUILD_TESTING=ON`. The linked library was copied and NID-patched with the project tool. `audio_out2_device_state` and `public_headers` each passed three consecutive CTest runs (6/6 runs, no skips). SHA-256: unpatched `4933823f44a05526b6451cb87a76d51ac8cf590eb44586fa9ee4b33793142682`; patched `f3cf38bab3de741437b3848eccba0b0adfa08ac42d63dc58d8ea34705de33c3a`. The full CTest suite was not run. - Exact-head GitHub [Build](https://github.com/boykopovar/AnyPS5/actions/runs/43027638383) (including Windows), [Emscripten portability](https://github.com/boykopovar/AnyPS5/actions/runs/43027638450), and [Progress report](https://github.com/boykopovar/AnyPS5/actions/runs/43027638509) workflows passed. No game or GPU test. ### 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 AudioOut2 export - [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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!18044
No description provided.