Repository navigation
fix(libSceAudiodecCpu): probe guest size-query pointers - #20388
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Review in progress — reader access unavailable
I could not inspect the prepared review folder or repository because the provided reader command could not be run in this environment.
What I ran
- Attempted to invoke
repo_read.pythrough the available tool interface; the command runner was unavailable.
Results
| Check | Result | Note |
|---|---|---|
| Review materials | not run | Reader access unavailable |
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The change description, commits, diff, manifest, changed files, and repository context were not read. No files can be reported as reviewed.
To get this to a good state
Provide a working reader interface so the pinned change can be inspected.
|
Withdrawn: the automated review posted on this pull request (review 5909104210 or 5910118205 respectively) was sent by mistake. It did not complete and reports no finding. Please disregard it. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The change adds guest-memory checks to the two audiodec memory-size queries, and I found no blocking defect when reading the reviewed head.
What I ran
- Head reviewed: 5ab1cf0 (merged).
- Read the four changed files at that head and the diff.
- Checked the GuestCopyIn/GuestCopyOut declarations (argument order matches), the AudiodecCtrl and AudiodecCpuMemory layouts (the first fields are the ones read), and the repository conventions for throwing on unreadable guest memory and for library-local CMake registration.
- Did not build or run tests. The precheck refuses closed pull requests and did not run.
Results
| Check | Result | Note |
|---|---|---|
| Source review | passed | Null, size and type check order kept |
| Guest copy argument order | passed | Matches the declarations |
| Struct layouts | passed | Read fields are first in their structs |
| Repository conventions | passed | Library-local CMake and debt fragment |
| Build and runtime tests | not run | Not built here |
| Hosted CI | passed | 7 success, 7 skipped |
| Precheck | not applicable | Pull request is closed |
Findings
Blocking
None.
Non-blocking
- A bad control or descriptor pointer now throws std::runtime_error (Export.cpp lines 162, 168, 176) instead of faulting the host. The repository uses the same pattern for guest memory, but the export trampoline's handling of the exception was not checked.
Sources
- QueryMemSize:
AnyPS5/core/libs/prx/libSceAudiodecCpu/Export.cpp
Lines 156 to 177 in 5ab1cf0
- GuestCopyIn/Out declarations:
AnyPS5/core/libs/prx/libc/include/General.hpp
Lines 40 to 41 in 5ab1cf0
- AudiodecCpuMemory:
AnyPS5/core/libs/prx/libSceAudiodecCpu/include/Api.hpp
Lines 5 to 9 in 5ab1cf0
- AudiodecCtrl:
Lines 925 to 930 in 5ab1cf0
Not verified
- Build, the focused regression test and the existing AudiodecCpu suite were not run here. The ASan results are the author's.
- Exception handling at the export boundary.
To get this to a good state
Not applicable: the pull request is merged.
What
Both
sceAudiodecCpuQueryMemSizeandsceAudiodecCpuInternalQueryMemSizedereferenced the guest-supplied decoder control and work-memory descriptor directly, then wroteui_memory_sizedirectly. A non-null unmapped control pointer (0x10) crashed the host before the query could return. Valid Blu-ray and DVD LPCM queries already have a 0x190138-byte result and specific null, descriptor-size and codec validation behavior covered by the existing library test.Probe exactly the fields this query needs with
GuestCopyIn_nid_no_patch(the control'spParamand the memory descriptor'sui_size), and write onlyui_memory_sizethroughGuestCopyOut_nid_no_patch, preservingerrno. Keep the original null/size/type check order and result bytes. An inaccessible non-null guest pointer now throwsstd::runtime_errorrather than asserting any unmeasured console error code. A library-local CMake file registers the focused test without changing the large shared root CMake file. Document the safety fallback through a valid technical-debt fragment, with no direct debt-file edit. Decode/initialization paths are not changed.Tested
-fsanitize=address,undefined -fno-omit-frame-pointer -ffunction-sections -fdata-sections -Wl,--gc-sections, linking the newcore/libs/tests/GuestAudiodecCpuQueryGuest.cppdirectly against the originalcore/libs/prx/libSceAudiodecCpu/Export.cppand actuallibc/src/General.cpp,GuestArena.cpp,GuestWriteWatch.cpp. AddressSanitizer aborted on a READ at0x10, inQueryMemSize,Export.cpp:156, reached fromsceAudiodecCpuQueryMemSize. Reproduced with the final unchanged regression using the unmodified copy ofExport.cppin a separate untouched worktree.errno, null/size/type validation precedence, unchanged 0x190138-byte outputs through both public/internal query aliases, preservation of other output fields, valid descriptors abutting a guard page, writes crossing into a protected page, and read-only output rejection.GuestAudiodecCpu.cppsuite PASS under GCC 13 ASan/UBSan linked to the patched productionExport.cppand the same real libc guest-memory helpers. This exercises the existing decoder, work-memory query, format and LPCM output tests, not just the new focused test. Standalone harnesses use an external no-op missing-function reporting shim solely for linking; the productionNotImplementedAtthrow and guest-copy implementations are unchanged.g++ -std=c++20 -Wall -Wextra -Werror -fsyntax-only -Icore/libs -Icorepassed on both productionExport.cppand newGuestAudiodecCpuQueryGuest.cpp.python tools/check_conventions.py --base upstream/main,python tools/debt_fold.py --check, andgit diff HEAD^ HEAD --checkpassed. The independent library-name overlap scan found no competing query implementation among 1,530 open PRs; the complete post-rebase branch overlap scan of 1,508 open PRs returned No overlap. Prior closed/mergedlibSceAudiodecCpuwork (test(libSceAudiodecCpu): cover internal API parameter validation and error states #17324, feat(libSceAudiodecCpu): wrap Blu-ray LPCM output past the module's 0x43800-byte buffer #17649) was screened; neither implemented this guest-memory check. An initial root-CMake test registration failed the full overlap scan; it was removed before this PR, and the clean scan was repeated against the library-local registration.-DANYPS5_USE_SYSTEM_DEPS=ON -DBUILD_TESTING=ON) was blocked before target generation by missingSDL2Config.cmake; full module-loading CTest and actual PS5/game testing were not performed. WSL's guest-write watch reported its existing memory-comparison fallback when asynchronoususerfaultfdwrite protection was unavailable.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)