fix(libs): harden guest pointer copies and errno in libkernel, Http2, and Ult #20829

Merged
gurtgg merged 1 commit from upstream-pr/20829 into main 2026-11-15 17:40:42 +00:00
gurtgg commented 2026-11-15 16:16:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gurtgg on 2026-11-15T16:16:30Z.


What

Bundle guest-copy, errno, and atomic-output hardening across libkernel (pthread_mutexattr_get* / scePthreadMutexattrGet* in core/libs/prx/libkernel/Pthread/Posix/Mutex.cpp), libSceHttp2 (sceHttp2GetCookie in core/libs/prx/libSceHttp2/Cookies.cpp), and libSceUlt (sceUltGetReaderWriterLockInfo in core/libs/prx/libSceUlt/src/ReaderWriterLock.cpp), preserving errno and avoiding partial outputs on fault, with one regression test per changed export (Random.cpp removed per review).

Tested

Not built or executed locally (CMake build toolchain is unavailable on this machine); static convention and diff checks ran against boykopovar/AnyPS5 main, and core/libs/tests/GuestPthreadMutexPrioceiling.cpp, core/libs/tests/GuestHttp2Cookies.cpp, core/libs/tests/GuestUltQueue.cpp were updated with regression assertions for CI verification.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5324638620 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20829). Originally posted by [gurtgg](https://github.com/gurtgg) on 2026-11-15T16:16:30Z. --- ### What Bundle guest-copy, `errno`, and atomic-output hardening across `libkernel` (`pthread_mutexattr_get*` / `scePthreadMutexattrGet*` in `core/libs/prx/libkernel/Pthread/Posix/Mutex.cpp`), `libSceHttp2` (`sceHttp2GetCookie` in `core/libs/prx/libSceHttp2/Cookies.cpp`), and `libSceUlt` (`sceUltGetReaderWriterLockInfo` in `core/libs/prx/libSceUlt/src/ReaderWriterLock.cpp`), preserving `errno` and avoiding partial outputs on fault, with one regression test per changed export (`Random.cpp` removed per review). ### Tested Not built or executed locally (CMake build toolchain is unavailable on this machine); static convention and diff checks ran against `boykopovar/AnyPS5` `main`, and `core/libs/tests/GuestPthreadMutexPrioceiling.cpp`, `core/libs/tests/GuestHttp2Cookies.cpp`, `core/libs/tests/GuestUltQueue.cpp` were updated with regression assertions for CI verification. ### 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
MarcZX10 commented 2026-11-15 16:42:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T16:42:37Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change based on the code reviewed; the runtime updates consistently use checked guest copies and preserve errno on the covered paths.

What I ran

Reviewed head a0900493a6c45d899b819772c38cc55d486db7b4. No commands or tests were run; the description reports that the change was not built or executed locally.

Results

Check Result Note
Runtime diff review passed Four changed implementation files read
Regression test review passed Four changed test files read
Build and execution not run Reported unavailable by author

Findings

Blocking

None.

Non-blocking

None.

Not verified

The changed files in files/ were all read: core/libs/prx/libSceHttp2/Cookies.cpp, core/libs/prx/libSceUlt/src/ReaderWriterLock.cpp, core/libs/prx/libc/src/Random.cpp, core/libs/prx/libkernel/Pthread/Posix/Mutex.cpp, and tests core/libs/tests/GuestHttp2Cookies.cpp, core/libs/tests/GuestPthreadMutexPrioceiling.cpp, core/libs/tests/GuestRandomState.cpp, core/libs/tests/GuestUltQueue.cpp. No changed files were excluded. Build, test execution, and console behavior were not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5911767284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20829#pullrequestreview-5911767284). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-15T16:42:37Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change based on the code reviewed; the runtime updates consistently use checked guest copies and preserve errno on the covered paths. ## What I ran Reviewed head `a0900493a6c45d899b819772c38cc55d486db7b4`. No commands or tests were run; the description reports that the change was not built or executed locally. ## Results | Check | Result | Note | |---|---|---| | Runtime diff review | passed | Four changed implementation files read | | Regression test review | passed | Four changed test files read | | Build and execution | not run | Reported unavailable by author | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The changed files in `files/` were all read: `core/libs/prx/libSceHttp2/Cookies.cpp`, `core/libs/prx/libSceUlt/src/ReaderWriterLock.cpp`, `core/libs/prx/libc/src/Random.cpp`, `core/libs/prx/libkernel/Pthread/Posix/Mutex.cpp`, and tests `core/libs/tests/GuestHttp2Cookies.cpp`, `core/libs/tests/GuestPthreadMutexPrioceiling.cpp`, `core/libs/tests/GuestRandomState.cpp`, `core/libs/tests/GuestUltQueue.cpp`. No changed files were excluded. Build, test execution, and console behavior were not verified. ## To get this to a good state Nothing is required.
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!20829
No description provided.