fix(libSceAmpr): copy remaining command buffer and cnd name guest pointers via GuestCopyIn/Out #20633
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20633"
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 PrivacyOnion on 2026-11-15T11:23:07Z.
What
Copy the remaining guest
Apr::CommandBufferObject*and_Cnd_init_with_name_nid_postfixconst char* nameparameters incore/libs/prx/libSceAmpr/Export.cppviaGuestCopyIn/GuestCopyOut/CopyGuestString_nid_no_patch(preserving callererrnoviaErrnoGuardand returningSCE_KERNEL_ERROR_EFAULTor settingerrno = 14/63with return4on fault), and add invalid-pointer tests incore/libs/tests/GuestAmpr.cpp:sceAmprAprCommandBufferConstructorsceAmprAprCommandBufferMapEndsceAmprAprCommandBufferReadFileGathersceAmprAprCommandBufferResetGatherScatterStatesceAmprCommandBufferConstructNopsceAmprCommandBufferNopsceAmprCommandBufferNopWithDatasceAmprCommandBufferResetsceAmprAmmCommandBufferUnmapsceAmprAmmCommandBufferRemapIntoPrtsceAmprAmmCommandBufferUnmapToPrt_Cnd_init_with_name_nid_postfixTested
python tools/guest_pointer_audit.py libSceAmpr->0 direct guest pointer accesses in 0 exported functionsg++.exe -std=gnu++20 -fsyntax-only -D_fflush_nolock=fflushoncore/libs/prx/libSceAmpr/Export.cppandcore/libs/tests/GuestAmpr.cpp-> exit 0python tools/check_conventions.py --base upstream/main --head fix/ampr-guest-copy-remaining->All conventions checks passed.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T06:11:17Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: synchronize the command-buffer metadata when
sceAmprCommandBufferConstructNopexpands its backing buffer.What I ran
Reviewed head
a3470677b6f42a61ba90735a44b01f42509e9fb8. No commands or tests were run; I inspected the prepared diff and targeted source throughrepo_read.py.Results
Findings
Blocking
core/libs/prx/libSceAmpr/Export.cpp:596:AppendNopcan growlocal.baseandlocal.sizethroughEnsureCommandCapacity, but the call here passesnullptrfor payload and does not copylocalback until line 610. If that append is the one that triggers expansion, the command bytes are written to the new allocation while the guest buffer still points to the freed/original allocation. A failed subsequent guest write also leaves the expanded allocation recorded against the buffer. Copy the updated metadata back immediately after the append/capacity operation, before writing trailing data, while preserving safe failure behavior.Non-blocking
None.
Not verified
core/libs/prx/libSceAmpr/Export.cppandcore/libs/tests/GuestAmpr.cpp; both were included in the review bundle. No changed files were excluded according to the manifest.To get this to a good state
Fix the construct-NOP expansion path so the guest command buffer is synchronized with its new backing allocation, then rerun the relevant tests and checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:44:01Z.
Review: COMMENTED
This head conflicts where main added
OriginalBufferBaseto recover the caller's pointer after command storage expands. Please keep that lookup when threading the staged command-buffer copy throughAppendand the publish paths. Otherwise the rebased change could alter which storage the caller gets back.AI-assisted: yes.
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.