fix(libSceAmpr): copy guest command buffer objects instead of dereferencing them #21552

Closed
Gruzzberry wants to merge 1 commit from upstream-pr/21552 into main
Gruzzberry commented 2026-11-16 11:39:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-11-16T11:39:28Z.


What

libSceAmpr command-buffer exports read and wrote the guest CommandBufferObject through raw pointers (buffer->base, ->offset, ->recording, ->type, &buffer->offset) and called strlen on a guest name in _Cnd_init_with_name. Every access now goes through a staged local copy using GuestCopyIn_nid_no_patch / GuestCopyOut_nid_no_patch (the existing CopyGuestIn/CopyGuestOut helpers) and CopyGuestString_nid_no_patch. A fault returns SCE_KERNEL_ERROR_EFAULT. tools/guest_pointer_audit.py libSceAmpr goes from 12 findings to 0.

Tested

Windows host. Ran tools/guest_pointer_audit.py libSceAmpr (12 to 0) and tools/check_conventions.py --base upstream/main (passes). Not built and not run: no compile and no title or homebrew test.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5336297778 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21552). Originally posted by [Gruzzberry](https://github.com/Gruzzberry) on 2026-11-16T11:39:28Z. --- ### What libSceAmpr command-buffer exports read and wrote the guest `CommandBufferObject` through raw pointers (`buffer->base`, `->offset`, `->recording`, `->type`, `&buffer->offset`) and called `strlen` on a guest name in `_Cnd_init_with_name`. Every access now goes through a staged local copy using `GuestCopyIn_nid_no_patch` / `GuestCopyOut_nid_no_patch` (the existing `CopyGuestIn`/`CopyGuestOut` helpers) and `CopyGuestString_nid_no_patch`. A fault returns `SCE_KERNEL_ERROR_EFAULT`. `tools/guest_pointer_audit.py libSceAmpr` goes from 12 findings to 0. ### Tested Windows host. Ran `tools/guest_pointer_audit.py libSceAmpr` (12 to 0) and `tools/check_conventions.py --base upstream/main` (passes). Not built and not run: no compile and no title or homebrew test. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [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) and the licence notice of code adapted from upstream (see AGENTS.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 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull request closed

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!21552
No description provided.