feat(libSceLibcInternal): implement std mutex object lifecycle and locking #19602

Merged
fogydes merged 3 commits from upstream-pr/19602 into main 2026-11-30 04:56:56 +00:00
fogydes commented 2026-11-13 15:42:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-11-13T15:42:27Z.


What

Implement all six unversioned std::_Mutex constructor/destructor/lock/unlock exports using the existing guest heap and mutex primitives. Each constructor allocates one eight-byte mutex slot, publishes it into the one-pointer object, and initializes it with the SDK's C++ name. Destruction destroys the mutex, reloads the object's slot, and deletes nonnull storage without clearing the object. Lock/unlock forward the stored slot and ignore primitive status as the SDK does.

Destruction explicitly catches escaping exceptions and invokes guest std::terminate. SDK 10.00's destructor has that termination landing pad; compiler-only noexcept was insufficient with the current guest personality, which continued through a GCC no-call-site region. The focused test registers a guest terminate handler and fails if an exception propagates. The general personality gap is recorded in libc debt; no global exception implementation is changed.

Clean-room evidence: readable libc.prx, SDK 10.00, C1/C2 at 0xb8080, D1/D2 at 0xb80b0 and termination 0xb80d5, lock0xb80e0, unlock0xb80f0; allocation 0xb808e, publication 0xb809d, initialization 0xb80a0; destroy 0xb80bc, slot reload 0xb80c1, delete 0xb80c9. target/include/yvals.h:1918-1933 supplies the one-pointer class declaration. No reference binaries/extracts are attached/linked and no console measurement is claimed.

Unreadable object/slot and unwritable constructor destinations throw as documented host-safety policy; failed destination publication frees the allocation. Forged handles, concurrent slot mutation and firmware fault behavior retain native/unverified preconditions.

Based on main 4c0998e1a81. Remaining gaps and removed stub-inventory entries use docs/dev/debt/changes/libSceLibcInternal-mutex-objects.md; canonical debt files are unchanged. No new third-party code is added.

Tested

Windows 11 / WinLibs GCC 15.2 Release at b0ffc06914eb4abee710a9806b561b788d821b4a: rebuilt affected runtime libraries and test targets; 5/5 CTests passed (guest_mutex_object, guest_mutex_object_termination, guest_libc_internal_mtx, guest_freebsd_clocks, guest_appcontent). The termination test requires the guest terminate-handler marker. The object tests cover layout, recursive ownership, blocked waiters, application allocation/deallocation and invalid memory. Current conventions, debt-fragment validation, whitespace and merge-tree checks passed.

The earlier shared AppContent CI failure was independently reproduced using CI-main source; main now includes its upstream #20058 revert. The former clock abort did not reproduce in five consecutive local runs. The mutex implementation and test blobs are unchanged by these main merges. New hosted checks are pending.

Original export measurement at main 228330220ba: 424 → 430 implemented, 706 → 700 TODO, 1,130 total; all six NIDs were already present as throwing exports. These are historical counts, not a current-main recount. Original SDK-backed runtime validation and manual overlap inspection found no competing mutex implementation or behavioral dependency; automated overlap had stale heads and did not establish globally clean mergeability. No console, title, GPU or performance claim.

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

Summary by CodeRabbit

  • New Features
    • Added support for creating, destroying, locking, and unlocking guest mutexes, including compatibility with constructor and destructor variants.
  • Bug Fixes
    • Improved handling of invalid guest mutex data and cleanup failures, helping prevent resource leaks and ensuring termination when destruction cannot complete.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5298419867 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19602). Originally posted by [fogydes](https://github.com/fogydes) on 2026-11-13T15:42:27Z. --- ### What Implement all six unversioned std::_Mutex constructor/destructor/lock/unlock exports using the existing guest heap and mutex primitives. Each constructor allocates one eight-byte mutex slot, publishes it into the one-pointer object, and initializes it with the SDK's C++ name. Destruction destroys the mutex, reloads the object's slot, and deletes nonnull storage without clearing the object. Lock/unlock forward the stored slot and ignore primitive status as the SDK does. Destruction explicitly catches escaping exceptions and invokes guest std::terminate. SDK 10.00's destructor has that termination landing pad; compiler-only noexcept was insufficient with the current guest personality, which continued through a GCC no-call-site region. The focused test registers a guest terminate handler and fails if an exception propagates. The general personality gap is recorded in libc debt; no global exception implementation is changed. Clean-room evidence: readable libc.prx, SDK 10.00, C1/C2 at 0xb8080, D1/D2 at 0xb80b0 and termination 0xb80d5, lock0xb80e0, unlock0xb80f0; allocation 0xb808e, publication 0xb809d, initialization 0xb80a0; destroy 0xb80bc, slot reload 0xb80c1, delete 0xb80c9. target/include/yvals.h:1918-1933 supplies the one-pointer class declaration. No reference binaries/extracts are attached/linked and no console measurement is claimed. Unreadable object/slot and unwritable constructor destinations throw as documented host-safety policy; failed destination publication frees the allocation. Forged handles, concurrent slot mutation and firmware fault behavior retain native/unverified preconditions. Based on main `4c0998e1a81`. Remaining gaps and removed stub-inventory entries use `docs/dev/debt/changes/libSceLibcInternal-mutex-objects.md`; canonical debt files are unchanged. No new third-party code is added. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 / WinLibs GCC 15.2 Release at `b0ffc06914eb4abee710a9806b561b788d821b4a`: rebuilt affected runtime libraries and test targets; 5/5 CTests passed (`guest_mutex_object`, `guest_mutex_object_termination`, `guest_libc_internal_mtx`, `guest_freebsd_clocks`, `guest_appcontent`). The termination test requires the guest terminate-handler marker. The object tests cover layout, recursive ownership, blocked waiters, application allocation/deallocation and invalid memory. Current conventions, debt-fragment validation, whitespace and merge-tree checks passed. The earlier shared AppContent CI failure was independently reproduced using CI-main source; main now includes its upstream #20058 revert. The former clock abort did not reproduce in five consecutive local runs. The mutex implementation and test blobs are unchanged by these main merges. New hosted checks are pending. Original export measurement at main `228330220ba`: 424 → 430 implemented, 706 → 700 TODO, 1,130 total; all six NIDs were already present as throwing exports. These are historical counts, not a current-main recount. Original SDK-backed runtime validation and manual overlap inspection found no competing mutex implementation or behavioral dependency; automated overlap had stale heads and did not establish globally clean mergeability. No console, title, GPU or performance claim. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added support for creating, destroying, locking, and unlocking guest mutexes, including compatibility with constructor and destructor variants. * **Bug Fixes** * Improved handling of invalid guest mutex data and cleanup failures, helping prevent resource leaks and ensuring termination when destruction cannot complete. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-11-20 10:08:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T10:08:58Z.

Review: DISMISSED


Reviewed — changes requested

Changes are required before merge: handle mutex initialization failure before leaving the object constructed.

What I ran

Reviewed head 3ae4623c7da44462feab38c7c4fd62f2de3ee0ea. Read the prepared description, commits, diff and manifest, then used repo_read.py to inspect the changed implementation and the allocator and mutex primitives it calls. No build or tests were run in this review.

Results

Check Result Note
Source review failed Initialization failure is ignored
Build and tests not run No commands run

Findings

Blocking

  • core/libs/prx/libSceLibcInternal/MutexObject.cpp:38: construction ignores _Mtxinit_nid_postfix's status. The existing primitive returns nonzero when attribute setup or mutex initialization fails. In that case the constructor returns successfully with published storage that may not hold an initialized mutex, so later lock, unlock, or destruction operates on invalid state. Check the result and clean up the storage/object consistently before reporting construction failure.

Non-blocking

None.

Not verified

No build, CTest, CI, console execution, or firmware behavior was verified. Read all files listed as reviewed in the manifest, including the changed source, tests, headers, CMake configuration, export inventory edits, and debt note. files.json was not available in the prepared review resources, so excluded files are not verified.

To get this to a good state

Handle _Mtxinit_nid_postfix failure and add coverage for that failure path; then rerun the focused mutex object tests on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990951235 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19602#pullrequestreview-5990951235). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T10:08:58Z. **Review:** DISMISSED --- # Reviewed — changes requested Changes are required before merge: handle mutex initialization failure before leaving the object constructed. ## What I ran Reviewed head `3ae4623c7da44462feab38c7c4fd62f2de3ee0ea`. Read the prepared description, commits, diff and manifest, then used `repo_read.py` to inspect the changed implementation and the allocator and mutex primitives it calls. No build or tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | Initialization failure is ignored | | Build and tests | not run | No commands run | ## Findings ### Blocking - `core/libs/prx/libSceLibcInternal/MutexObject.cpp:38`: construction ignores `_Mtxinit_nid_postfix`'s status. The existing primitive returns nonzero when attribute setup or mutex initialization fails. In that case the constructor returns successfully with published storage that may not hold an initialized mutex, so later lock, unlock, or destruction operates on invalid state. Check the result and clean up the storage/object consistently before reporting construction failure. ### Non-blocking None. ## Not verified No build, CTest, CI, console execution, or firmware behavior was verified. Read all files listed as `reviewed` in the manifest, including the changed source, tests, headers, CMake configuration, export inventory edits, and debt note. `files.json` was not available in the prepared review resources, so excluded files are not verified. ## To get this to a good state Handle `_Mtxinit_nid_postfix` failure and add coverage for that failure path; then rerun the focused mutex object tests on the updated head.
MarcZX10 commented 2026-11-20 14:48:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T14:48:43Z.

Review: COMMENTED


Reviewed — comments

Nothing blocks this based on the code inspected; the points below should be verified before relying on the new wrappers.

What I ran

Reviewed head ceaac7409184ac3082fb73c2b239fc460561538d. No commands or tests were run. The author reports Windows 11 / WinLibs GCC 15.2 CTest results in the PR description; those were not independently run here.

Results

Check Result Note
Source review passed Implementation and related sources inspected
Tests not run Author-reported results only
Firmware behavior not run Console behavior remains unverified

Findings

Blocking

None verified.

Non-blocking

  • MutexObject.cpp:38 ignores _Mtxinit_nid_postfix’s status, then leaves the object pointing at the allocated slot. The existing primitive returns failure when mutex attribute setup or initialization fails. Consider handling that result and releasing the slot so the object is not left with an uninitialized mutex.
  • The added function definitions in MutexObject.cpp:62-87 do not show APS5_EXPORT registrations. Existing inventory-based exports use that macro to publish guest-visible NIDs. Verify that these wrappers are exported through another mechanism; the checked source did not establish this.

Not verified

No tests were run. No physical-console or firmware validation was performed. The following changed files were listed in manifest.json but not read at the head: core/libs/prx/libSceLibcInternal/CMakeLists.txt, core/libs/prx/libSceLibcInternal/InventoryExports.cpp, core/libs/prx/libSceLibcInternal/InventoryExports6.cpp, core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp, core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp, core/libs/prx/libSceLibcInternal/include/MutexObject.hpp, and core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp. I also did not inspect the full export-generation and packaging path, so symbol publication is not verified. The author’s reported test results and clean-room SDK observations were not independently checked.

Files read: review/description.md, review/commits.md, review/manifest.json, review/diff.patch, core/libs/prx/libSceLibcInternal/MutexObject.cpp, core/libs/prx/libSceLibcInternal/Mutex.cpp, core/libs/prx/libSceLibcInternal/include/Api.hpp, core/libs/prx/libSceLibcInternal/Export.cpp (lines 1–50), core/libs/prx/libc/src/StdioExtras.cpp, core/libs/prx/libc/src/General.cpp, core/libs/prx/libc/include/General.hpp, core/libs/prx/libc/include/general/ExportMacros.hpp, core/libs/prx/libkernel/Pthread/include/Mutex.hpp, core/libs/prx/libkernel/Pthread/src/Mutex.cpp, core/libs/SceTypes.hpp, core/libs/tests/GuestMutexObject.cpp, and docs/dev/debt/changes/libSceLibcInternal-mutex-objects.md. No files were excluded by rule according to the supplied manifest.

To get this to a good state

Nothing is required. Optional points: handle mutex initialization failure, and confirm that all six wrapper symbols are published in the guest export table.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5994524528 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19602#pullrequestreview-5994524528). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T14:48:43Z. **Review:** COMMENTED --- # Reviewed — comments Nothing blocks this based on the code inspected; the points below should be verified before relying on the new wrappers. ## What I ran Reviewed head `ceaac7409184ac3082fb73c2b239fc460561538d`. No commands or tests were run. The author reports Windows 11 / WinLibs GCC 15.2 CTest results in the PR description; those were not independently run here. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Implementation and related sources inspected | | Tests | not run | Author-reported results only | | Firmware behavior | not run | Console behavior remains unverified | ## Findings ### Blocking None verified. ### Non-blocking - `MutexObject.cpp:38` ignores `_Mtxinit_nid_postfix`’s status, then leaves the object pointing at the allocated slot. The existing primitive returns failure when mutex attribute setup or initialization fails. Consider handling that result and releasing the slot so the object is not left with an uninitialized mutex. - The added function definitions in `MutexObject.cpp:62-87` do not show `APS5_EXPORT` registrations. Existing inventory-based exports use that macro to publish guest-visible NIDs. Verify that these wrappers are exported through another mechanism; the checked source did not establish this. ## Not verified No tests were run. No physical-console or firmware validation was performed. The following changed files were listed in `manifest.json` but not read at the head: `core/libs/prx/libSceLibcInternal/CMakeLists.txt`, `core/libs/prx/libSceLibcInternal/InventoryExports.cpp`, `core/libs/prx/libSceLibcInternal/InventoryExports6.cpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp`, `core/libs/prx/libSceLibcInternal/include/MutexObject.hpp`, and `core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp`. I also did not inspect the full export-generation and packaging path, so symbol publication is not verified. The author’s reported test results and clean-room SDK observations were not independently checked. Files read: `review/description.md`, `review/commits.md`, `review/manifest.json`, `review/diff.patch`, `core/libs/prx/libSceLibcInternal/MutexObject.cpp`, `core/libs/prx/libSceLibcInternal/Mutex.cpp`, `core/libs/prx/libSceLibcInternal/include/Api.hpp`, `core/libs/prx/libSceLibcInternal/Export.cpp` (lines 1–50), `core/libs/prx/libc/src/StdioExtras.cpp`, `core/libs/prx/libc/src/General.cpp`, `core/libs/prx/libc/include/General.hpp`, `core/libs/prx/libc/include/general/ExportMacros.hpp`, `core/libs/prx/libkernel/Pthread/include/Mutex.hpp`, `core/libs/prx/libkernel/Pthread/src/Mutex.cpp`, `core/libs/SceTypes.hpp`, `core/libs/tests/GuestMutexObject.cpp`, and `docs/dev/debt/changes/libSceLibcInternal-mutex-objects.md`. No files were excluded by rule according to the supplied manifest. ## To get this to a good state Nothing is required. Optional points: handle mutex initialization failure, and confirm that all six wrapper symbols are published in the guest export table.
MarcZX10 commented 2026-11-22 12:46:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T12:46:39Z.

Review: COMMENTED


Reviewed — comments

The code inspected implements the described mutex wrappers; I did not run the reported checks or verify every changed file, so a formal decision is not justified.

What I ran

  • Inspected prepared diff and targeted files at head 971b982b84a34f7d1b930d035be4f7643258fd04 using the pinned repo_read.py reader.
  • No build or tests were run; test results in the description are author-reported.

Results

Check Result Note
Diff and source inspection passed Targeted code inspected
Reported Windows checks not run Author-reported only
Full changed-file review not run Not every changed file was read

Findings

Blocking

None verified in the inspected code.

Non-blocking

None.

Not verified

I read description.md, commits.md, manifest.json, and diff.patch; repository files read: core/libs/prx/libSceLibcInternal/MutexObject.cpp, core/libs/prx/libSceLibcInternal/CMakeLists.txt, core/libs/prx/libSceLibcInternal/InventoryExports6.cpp, core/libs/prx/libSceLibcInternal/include/MutexObject.hpp, core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp, core/libs/prx/libSceLibcInternal/Mutex.cpp, core/libs/prx/libc/src/StdioExtras.cpp, core/libs/prx/libkernel/Pthread/include/Mutex.hpp, and core/libs/tests/GuestMutexObject.cpp. The remaining changed files listed in manifest.json were not read in full; behavior on console and the author-reported test runs were not verified.

To get this to a good state

Nothing is required. Optional: complete the review of the remaining changed files and run the reported checks on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012334172 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19602#pullrequestreview-6012334172). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T12:46:39Z. **Review:** COMMENTED --- # Reviewed — comments The code inspected implements the described mutex wrappers; I did not run the reported checks or verify every changed file, so a formal decision is not justified. ## What I ran - Inspected prepared diff and targeted files at head `971b982b84a34f7d1b930d035be4f7643258fd04` using the pinned `repo_read.py` reader. - No build or tests were run; test results in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff and source inspection | passed | Targeted code inspected | | Reported Windows checks | not run | Author-reported only | | Full changed-file review | not run | Not every changed file was read | ## Findings ### Blocking None verified in the inspected code. ### Non-blocking None. ## Not verified I read `description.md`, `commits.md`, `manifest.json`, and `diff.patch`; repository files read: `core/libs/prx/libSceLibcInternal/MutexObject.cpp`, `core/libs/prx/libSceLibcInternal/CMakeLists.txt`, `core/libs/prx/libSceLibcInternal/InventoryExports6.cpp`, `core/libs/prx/libSceLibcInternal/include/MutexObject.hpp`, `core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp`, `core/libs/prx/libSceLibcInternal/Mutex.cpp`, `core/libs/prx/libc/src/StdioExtras.cpp`, `core/libs/prx/libkernel/Pthread/include/Mutex.hpp`, and `core/libs/tests/GuestMutexObject.cpp`. The remaining changed files listed in `manifest.json` were not read in full; behavior on console and the author-reported test runs were not verified. ## To get this to a good state Nothing is required. Optional: complete the review of the remaining changed files and run the reported checks on this head.
MarcZX10 commented 2026-11-25 11:10:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T11:10:24Z.

Review: COMMENTED


Reviewed — no blocking findings

No blocking defect was verified in the implementation paths inspected, but the review is incomplete because several changed files were not read in full.

What I ran

Reviewed head a43d24d800033677263eb6e89cb2f1e0d59acaf3. I used the prepared diff and repository reader; I ran no build or tests. The author reports Windows 11 / WinLibs GCC 15.2 tests in the PR description; I did not run them.

Results

Check Result Note
Diff and implementation review passed Core mutex paths inspected
Build and tests not run Author-reported results only
Changed-file review not run Several changed files not read in full

Findings

Blocking

None verified in the code inspected.

Non-blocking

None.

Not verified

I read the review description, commits, manifest, and diff; the changed mutex implementation and header, its test, the relevant CMake section, mutex primitive implementation, and relevant portions of the export files and API declarations. I did not read the full text of InventoryExports.cpp, include/InventoryExports.hpp, include/InventoryExports6.hpp, libSceLibcInternal.hpp, or docs/dev/debt/changes/libSceLibcInternal-mutex-objects.md. The export source/header changes were visible in the prepared diff, but their full file contents were not reviewed. I did not independently verify SDK binary claims, run tests, or check console behavior.

To get this to a good state

Nothing is required. Optional: complete review of the unread changed files before making a formal approval decision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6056516840 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19602#pullrequestreview-6056516840). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T11:10:24Z. **Review:** COMMENTED --- # Reviewed — no blocking findings No blocking defect was verified in the implementation paths inspected, but the review is incomplete because several changed files were not read in full. ## What I ran Reviewed head `a43d24d800033677263eb6e89cb2f1e0d59acaf3`. I used the prepared diff and repository reader; I ran no build or tests. The author reports Windows 11 / WinLibs GCC 15.2 tests in the PR description; I did not run them. ## Results | Check | Result | Note | |---|---|---| | Diff and implementation review | passed | Core mutex paths inspected | | Build and tests | not run | Author-reported results only | | Changed-file review | not run | Several changed files not read in full | ## Findings ### Blocking None verified in the code inspected. ### Non-blocking None. ## Not verified I read the review description, commits, manifest, and diff; the changed mutex implementation and header, its test, the relevant CMake section, mutex primitive implementation, and relevant portions of the export files and API declarations. I did not read the full text of `InventoryExports.cpp`, `include/InventoryExports.hpp`, `include/InventoryExports6.hpp`, `libSceLibcInternal.hpp`, or `docs/dev/debt/changes/libSceLibcInternal-mutex-objects.md`. The export source/header changes were visible in the prepared diff, but their full file contents were not reviewed. I did not independently verify SDK binary claims, run tests, or check console behavior. ## To get this to a good state Nothing is required. Optional: complete review of the unread changed files before making a formal approval decision.
MarcZX10 commented 2026-11-25 12:51:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T12:51:16Z.

Review: COMMENTED


Reviewed — comments

The review covered all ten changed files at head 42cebf894180a166017a5f2e9d17d5697ea63870; no verified blocking defect was found, but one lifecycle edge case needs clarification or coverage before I can recommend approval.

What I ran

  • Read the prepared description, commit list, diff, manifest, and all ten changed files at the pinned head.
  • No build or test commands were run; the test results in the PR description are author-reported.

Results

Check Result Note
Changed-file review passed All ten changed files read
Build and tests not run Reported results not independently verified
Console behavior not run Description says no console measurement

Findings

Blocking

None.

Non-blocking

  • Destroy_nid_no_patch reads the stored pointer and checks its memory before entering the try block in DestroyStorage_nid_no_patch (core/libs/prx/libSceLibcInternal/MutexObject.cpp:52). If either guest read throws, the destructor propagates the exception instead of calling guest std::terminate. The tested termination case only throws during the later release callback, after entering the try block. Consider covering unreadable object/storage errors under the destructor's termination policy, or clarify that termination is guaranteed only for errors during destroy and release.

Not verified

  • No commands were run, so the reported Windows 11 / WinLibs GCC 15.2 build and 5/5 CTest results were not independently checked.
  • No console execution or firmware behavior was verified.
  • All changed files listed in the manifest were included and read; none were excluded.

To get this to a good state

Nothing is required. Optional: align destructor termination handling with the stated policy for exceptions from its initial guest reads, and add a focused test if that behavior is intended.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6057937418 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19602#pullrequestreview-6057937418). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T12:51:16Z. **Review:** COMMENTED --- # Reviewed — comments The review covered all ten changed files at head `42cebf894180a166017a5f2e9d17d5697ea63870`; no verified blocking defect was found, but one lifecycle edge case needs clarification or coverage before I can recommend approval. ## What I ran - Read the prepared description, commit list, diff, manifest, and all ten changed files at the pinned head. - No build or test commands were run; the test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Changed-file review | passed | All ten changed files read | | Build and tests | not run | Reported results not independently verified | | Console behavior | not run | Description says no console measurement | ## Findings ### Blocking None. ### Non-blocking - `Destroy_nid_no_patch` reads the stored pointer and checks its memory before entering the `try` block in `DestroyStorage_nid_no_patch` (`core/libs/prx/libSceLibcInternal/MutexObject.cpp:52`). If either guest read throws, the destructor propagates the exception instead of calling guest `std::terminate`. The tested termination case only throws during the later release callback, after entering the `try` block. Consider covering unreadable object/storage errors under the destructor's termination policy, or clarify that termination is guaranteed only for errors during destroy and release. ## Not verified - No commands were run, so the reported Windows 11 / WinLibs GCC 15.2 build and 5/5 CTest results were not independently checked. - No console execution or firmware behavior was verified. - All changed files listed in the manifest were included and read; none were excluded. ## To get this to a good state Nothing is required. Optional: align destructor termination handling with the stated policy for exceptions from its initial guest reads, and add a focused test if that behavior is intended.
MarcZX10 commented 2026-11-30 02:58:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T02:58:31Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the available evidence supports the implementation, though tests were not run in this review.

What I ran

Reviewed head 07fa83644830000912d977e59d35373287e7e36b using the prepared diff and repo_read.py reader. No commands or tests were run; the reader interface provides source access only.

Results

Check Result Note
Diff and changed source review passed Reviewed the implementation, export wiring, and related APIs
Tests not run Author reports 5/5 CTests passed on the stated build

Findings

Blocking

None.

Non-blocking

None.

Not verified

Tests, builds, and runtime behavior were not independently verified. Reviewed all changed files listed in the manifest, including the new implementation, test, and debt note; no changed files were excluded by the manifest. The report's SDK binary analysis and console behavior were not independently confirmed.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6106391484 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19602#pullrequestreview-6106391484). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-30T02:58:31Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the available evidence supports the implementation, though tests were not run in this review. ## What I ran Reviewed head `07fa83644830000912d977e59d35373287e7e36b` using the prepared diff and `repo_read.py` reader. No commands or tests were run; the reader interface provides source access only. ## Results | Check | Result | Note | |---|---|---| | Diff and changed source review | passed | Reviewed the implementation, export wiring, and related APIs | | Tests | not run | Author reports 5/5 CTests passed on the stated build | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Tests, builds, and runtime behavior were not independently verified. Reviewed all changed files listed in the manifest, including the new implementation, test, and debt note; no changed files were excluded by the manifest. The report's SDK binary analysis and console behavior were not independently confirmed. ## To get this to a good state Nothing is required.
coderabbitai[bot] commented 2026-11-30 03:03:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T03:03:33Z.

Review: COMMENTED


Architecture findings (2)

Advisory architecture findings (2)

  • Minor — Construction publishes storage before initialization and returns normally if initialization reports failure, even when that failure occurs before a mutex is installed. The rollback handles a copy that returns false, but not a throwing copy or an exception during initialization. This leaves no consistent cleanup or caller-visible failure contract for partial construction.
  • Minor — Teardown does not condition storage release on the mutex having been destroyed or on the reloaded pointer identifying the same allocation. A busy result leaves the native mutex live but does not stop release of its slot; a changed slot can make teardown release different storage. The documented caller preconditions explain the compatibility choice but do not enforce ownership or failure containment.
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 01a39512-79bb-481e-8a71-9e5653efeb72
Commits

Reviewing files that changed from the base of the PR and between 5ed18b5d5a and 07fa836448.

Files selected for processing: 10

  • core/libs/prx/libSceLibcInternal/CMakeLists.txt
  • core/libs/prx/libSceLibcInternal/InventoryExports.cpp
  • core/libs/prx/libSceLibcInternal/InventoryExports6.cpp
  • core/libs/prx/libSceLibcInternal/MutexObject.cpp
  • core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp
  • core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp
  • core/libs/prx/libSceLibcInternal/include/MutexObject.hpp
  • core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp
  • core/libs/tests/GuestMutexObject.cpp
  • docs/dev/debt/changes/libSceLibcInternal-mutex-objects.md
Files with no reviewable changes: 4

  • core/libs/prx/libSceLibcInternal/InventoryExports.cpp
  • core/libs/prx/libSceLibcInternal/InventoryExports6.cpp
  • core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp
  • core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6106418091 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19602#pullrequestreview-6106418091). Originally posted by [coderabbitai[bot]](https://github.com/apps/coderabbitai) on 2026-11-30T03:03:33Z. **Review:** COMMENTED --- <!-- coderabbit-ai-generated:v1 --> **Architecture findings (2)** <details> <summary>Advisory architecture findings (2)</summary> <dl> <dd> <br> - **Minor** — Construction publishes storage before initialization and returns normally if initialization reports failure, even when that failure occurs before a mutex is installed. The rollback handles a copy that returns false, but not a throwing copy or an exception during initialization. This leaves no consistent cleanup or caller-visible failure contract for partial construction. - **Minor** — Teardown does not condition storage release on the mutex having been destroyed or on the reloaded pointer identifying the same allocation. A busy result leaves the native mutex live but does not stop release of its slot; a changed slot can make teardown release different storage. The documented caller preconditions explain the compatibility choice but do not enforce ownership or failure containment. </dd> </dl> </details> <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: Unavailable - **Branch**: Unavailable - **File**: No configuration file from this repository applied - **Commit**: Unavailable - **Layers**: defaults - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `01a39512-79bb-481e-8a71-9e5653efeb72` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 5ed18b5d5a5135b797f9972bde04e9ec6452f031 and 07fa83644830000912d977e59d35373287e7e36b. </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 10</summary> <dl> <dd> <br> * `core/libs/prx/libSceLibcInternal/CMakeLists.txt` * `core/libs/prx/libSceLibcInternal/InventoryExports.cpp` * `core/libs/prx/libSceLibcInternal/InventoryExports6.cpp` * `core/libs/prx/libSceLibcInternal/MutexObject.cpp` * `core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp` * `core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp` * `core/libs/prx/libSceLibcInternal/include/MutexObject.hpp` * `core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp` * `core/libs/tests/GuestMutexObject.cpp` * `docs/dev/debt/changes/libSceLibcInternal-mutex-objects.md` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-no-changes-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-no-changes.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files with no reviewable changes: 4</summary> <dl> <dd> <br> * core/libs/prx/libSceLibcInternal/InventoryExports.cpp * core/libs/prx/libSceLibcInternal/InventoryExports6.cpp * core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp * core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=9ad6facd-4494-411c-9482-3f98a189a6f7 attempt=134cfceb-877b-4c9c-b68d-21f03333441e batch=1/1 -->
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!19602
No description provided.