fix(libSceAudiodecCpu): open HostWrite before checking decode outputs #28810
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28810"
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 NobleBrains on 2026-12-03T19:59:18Z.
What
sceAudiodecCpuDecodechecks its output pointers throughEnsureWritable, which calledGuestWritable_nid_no_patchoutside aGuestArena::HostWritescope. A page the write watch has made read-only could be taken for an unwritable pointer, and the call then throws.EnsureWritableopensGuestArena::HostWritebefore the check, treats a guard that does not open as unwritable, and keeps the caller'serrno. The messages are unchanged.core/libs/tests/GuestAudiodecCpuQueryGuest.cppchecks with aHostWritehook that a failing decode opens the guard on the read-onlypBsiInfo, and that a decode into a read-only PCM page succeeds when the hook makes the page writable again: same samples and sizes as a plain decode,errnokept.Tested
guest_audiodec_cpuandguest_audiodec_cpu_query_guestpassed (2/2). With the guard removed and the first hook check skipped, the new decode case aborts. The diff was applied to an oldermainwith other open macOS pull requests, not built from this branch.guest_audiodec_cpu_query_guestpassed (1/1). With the fix removed it fails at "EnsureWritable did not open HostWrite". I did not run the later commits (theguard.Open()check and the decode case) on Linux.python3 tools/pr_overlap.py --base main --branchreports #27277, which adds codecs to the same library. The conflicts are an include line and the place of the new test lines; it does not change the check inEnsureWritable.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)🤖 Generated with Claude Code
https://claude.ai/code/session_01GtiotZ92uvDBp76KjCvueG
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T20:07:17Z.
Review: COMMENTED
Actionable comments
6a981b54-b167-4649-b6a0-aba89321b034Reviewing files that changed from the base of the PR and between
700fae9438and1715cc022d.core/libs/prx/libSceAudiodecCpu/Export.cppcore/libs/tests/GuestAudiodecCpuQueryGuest.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:07:46Z.
Review: COMMENTED
guest_audiodec_cpu_query_guestpassed on Linux with1715cc022dmerged into the native test base6c6b29320f. The new assertion confirms that the hook runs for genuinely read-only BSI and decode still rejects it. A complementary successful decode using a watched output that the hook reopens would cover the behavior this patch enables. Please check the written decode values and preservederrnoin that case.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T20:42:14Z.
Review: COMMENTED
Actionable comments
22a08c83-8e09-4d67-9f24-47c337bdb180Reviewing files that changed from the base of the PR and between
1715cc022dandac39eff050.core/libs/tests/GuestAudiodecCpuQueryGuest.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:49:08Z.
Review: COMMENTED
The added watched-PCM case addresses my earlier coverage request.
guest_audiodec_cpu_query_guestpassed on Linux with this head applied to6c6b29320f. The fixture reopens a watched PCM page, compares all decoded samples with a writable reference, and checks guest sizes and errno after the write hook.Source review at
ac39eff050. The exact head trial-merges onto700fae9438.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T23:54:25Z.
Review: APPROVED
Reviewed — looks good
The reviewed change at
ac39eff050e7f8842ef33b38877b0effef872e95adds a scoped HostWrite check before decode output validation, and the inspected implementation and regression coverage support merging.What I ran
Read the prepared diff and full text of both changed files. Used
repo_read.pyat the pinned head to inspect the HostWrite and writable-range implementations. No build or tests were run.Results
Negative control
Not run by me. The author reports the new decode case aborts on macOS with the guard removed and its first hook check skipped; the first-commit Linux control reportedly fails when the fix is removed.
Findings
Blocking
None.
Non-blocking
None.
Sources
EnsureWritableopens HostWrite before checking writability.Not verified
No build, tests, Windows run, or console run was performed. Both files listed under
reviewedinfiles.jsonwere read;files.jsonlists no excluded files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-04T12:50:36Z.
Review: APPROVED
Verified on Windows 11 with WinLibs GCC 15.2.0 r7 (Release). I used a tree at
main63b98e5bf8(plus two unrelated commits of mine in libc and a LibreSSL test), with this PR applied together with #28881, #28810, #28806, #28776 and #28781, which touch separate files. I ran everystrict_nid_filter,guest_audiodec*,guest_np_manager*,guest_np_reachabilityand HarfBuzz test (31): all pass before the change, and all pass in 3 of 3 runs with it.That fills the "Windows: not tested" gap. Negative control, with
libSceAudiodecCpu/Export.cppas onmainand the new test kept:guest_audiodec_cpu_query_guestaborts with "AudiodecCpu query guest: EnsureWritable did not open HostWrite".The guard covers only the writability check. The writes themselves still go through
GuestCopyOut_nid_no_patchinCopyOut.Not run: a title.
AI-assisted: yes (Claude Code)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.