feat(libSceAcm): validate context and batch parameters in batch wait and lifecycle exports #7567
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7567"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T14:30:56Z.
What
Validates context handles and pointers in libSceAcm exports (sceAcmContextCreate, sceAcmContextDestroy, sceAcmBatchStartBuffer, sceAcmBatchStartBuffers, sceAcmBatchWait):
hle_audio_spatial.cpp).sceAcmBatchWaitsucceeds for any valid context without inspecting batch IDs (KytyPS5 and prosper do not track batches).batch_errorwhen provided.Tested
guest_acm_tests in core/libs/tests/GuestAcm.cpp testing context creation/destruction, parameter validation, double-destruction handling, batch wait tracking, and negative paths. Validated conventions with python tools/check_conventions.py --base origin/main.
Checklist
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T14:59:06Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libSceAcm.mdL5-10Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/tests/GuestAcm.cppcore/libs/prx/libSceAcm/Export.cppdocs/dev/debt/libSceAcm.mdImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-19T08:13:36Z.
Windows data point for
a6406334amerged ontomainfb0dc118f(together with #7388 in one tree,a8bdd9935; the two PRs touch different files): Windows 10 (10.0.19045), WinLibs GCC 15.2.0, Release,ctest -R '^guest_acm$'.core/libs/prx/libSceAcm/Export.cpprestored tomain(git checkout upstream/main -- core/libs/prx/libSceAcm/Export.cpp;git statusshows only that file staged, 17 insertions / 55 deletions; the newGuestAcm.cpptest kept): fails 3 of 3,guest_acm (Exit code 0xc0000409)(the test's abort path).Not tested: a title run, Linux,
guest_acmon any other tree.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-19T14:02:23Z.
@xXPBSXx Thank you for testing and sharing the Windows GCC 15.2 data point! Glad to hear
ctest -R '^guest_acm$'cleanly verifies the validation behavior (3/3 pass vs abort without the PR).Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T16:29:53Z.
Review: CHANGES_REQUESTED
Checked against the references; a few points before this can merge:
sceAcmBatchWaitrejecting an unknown or already-waited batch (Export.cpp:57-67) has no source. KytyPS5acm.cppreturns OK unconditionally for wait and destroy, and prosper (module-derived offsets) has no batch tracking either. A title that waits twice or on an id from another path would now get an error wheremainsucceeds. Please cite where this behaviour comes from, or limit the change to what is sourced.hle_audio_spatial.cppreturns0x81940002(BAD_CONTEXT, with0x81940006for null pointers), not0x80E30002. Please say which one is right and where it comes from, and put the unverified part under "Unknown function info" indocs/dev/debt/libSceAcm.md.docs/dev/debt/libSceAcm.md:5overlaps with #7064 (same line); that one merges first or this needs rebasing on it.Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-19T17:15:48Z.
@adriadam10 Thanks for the review and references!
Pushed commit
77cfd9eabaddressing all feedback:Batch Wait Behavior & Error Codes:
acm.cpp) and prosper:sceAcmBatchWaitsucceeds for any valid context without rejecting untracked or previously waited batch IDs.hle_audio_spatial.cpp:0x81940002(SCE_ACM_ERROR_BAD_CONTEXT) for invalid/unknown contexts and0x81940006(SCE_ACM_ERROR_BAD_POINTER) for null pointer arguments.core/libs/tests/GuestAcm.cppassertions to verify these exact return values (BadContextandBadPointer).Technical Debt & Overlap:
origin/main(00d7e611e).hle_audio_spatial.cpp, KytyPS5acm.cpp) and unmeasured hardware DSP scheduling underUnknown function infoindocs/dev/debt/libSceAcm.md.Checklist Update:
Unblocks: noneto avoid citing unverified title discussions.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T17:17:08Z.
Review: CHANGES_REQUESTED
Thanks, the earlier points are addressed (wait no longer rejects batches, error codes from prosper, debt entry). One thing left:
ContextRecord::batches(Export.cpp:16-18, inserted at:38and:54) is never read or erased any more now thatsceAcmBatchWaitdoesn't track batches, so everysceAcmBatchStartBuffer(s)call grows it until the context is destroyed. Nothing bounds it. Either drop the set (a context only needs to exist ing_contexts) or keep it with a bound and a reason to read it.docs/dev/debt/libSceAcm.md:9is missing its final period.Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-19T17:23:40Z.
@adriadam10 Thanks! Pushed commit
53617c5a6addressing both points: dropped the atches set completely so g_contexts is a flat std::unordered_set with no per-batch allocations, and added the missing final period to line 9 of docs/dev/debt/libSceAcm.md.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T01:33:11Z.
Both earlier points are addressed (
batchesset dropped, debt line ends with a period). Also updated the PR description, which still described batch rejection and the old error code. Checked: codes against prosper, test fails without the change, Windows data point from @xXPBSXx; merged.