fix(libkernel): allocate thread objects in guest memory #21969

Merged
B-Howell merged 2 commits from upstream-pr/21969 into main 2026-11-28 10:08:15 +00:00
B-Howell commented 2026-11-16 23:38:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by B-Howell on 2026-11-16T23:38:57Z.


What

scePthreadSelf, scePthreadCreate and pthread_self give the title the address of its PthreadPrivate. That object came from the host heap. On Windows the guest arena reserves everything below 0xfc00000000 at start-up, so later host allocations land above it, and some land above 2^40. Titles keep that address in 40-bit fields.

Bloodborne stalled silently in 5 of 6 runs, right after its first compute dispatch. A APS5_HANG_DUMP_SECS=25 dump of a stalled run shows:

  • The main thread spins in guest code at bloodborne.exe+0x21c8424 (cmp 0x18(%r13),%eax; jg back). It waits for a counter that the GXWorker threads raise.
  • GXWorker:1 sits in sceKernelWaitSema (libkernel.prx+0x5e066), called from bloodborne.exe+0x2046988. That caller is the title's own adaptive mutex: its error string is DLAdaptiveMutex::Lock logical error in dantelion2., from CSPlainAdaptiveMutexImp_sce.cpp.
  • GXWorker:2 to GXWorker:5 wait in scePthreadMutexLock.

The mutex stores scePthreadSelf() masked to 40 bits (movabs $0xffffffffff) in its lock word. After the cmpxchg succeeds, it compares the masked owner with the full scePthreadSelf(). If they differ, it treats the lock as contended and waits on the semaphore. Its try-lock path does the same: it takes the lock and then reports failure. So a thread whose object lies above 2^40 waits forever on a lock it owns.

In the stalled runs the GXWorker objects were at 0x0000013cdaacbc10; in the run that got further they were at 0x000000fc094b74a0, below 2^40. With this change they are at 0x0000000200221de0.

PthreadPrivate now has class operator new and operator delete backed by GuestHeap. That is libc's allocator for host-made objects the guest sees, already used by AvPlayer, Net and Ampr. Every PthreadPrivate comes from std::make_unique or delete: created threads, threads adopted by scePthreadSelf on Windows and on POSIX hosts, and the final release. So all of them now lie in registered guest memory. Freeing goes through GuestHeapFree, under the same unpinned-range rule as every other guest heap block, including the title's own free.

An independent review asked whether delete of a PthreadPrivate can end the process, because GuestHeapFree_nid_postfix throws once a lease pins the block past APS5_PIN_WAIT_MS and operator delete is noexcept. It does not add a new risk. Leases from GuestAllocationsAcquire_nid_postfix/AcquireAll snapshot every readable registered range, not ones the GPU uses (GuestAllocations.cpp L794-803, L865-874), so every guest heap block is pinned the same way, and the title's own free (ApplicationHeap.cpp L41 defaultFree) hits the same throw with guest frames above it that cannot catch it. The block is allocated with gpu = false and is never handed to the GPU; the wait defaults to 60 s while the pin waiter retires GPU work, so a throw there means the GPU is already stuck.

The debt fragment notes that the console's placement of these objects is not measured.

The test GuestThreadSelf.cpp requires the main thread object, a host thread adopted through scePthreadSelf (Windows), and a created thread to be registered guest allocations below 2^40.

Tested

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7, Release.

  • guest_thread_self: on main the new check aborts (exit 0xc0000409). With this change it passes.

  • Related tests: 104 pthread, thread, kernel-sys thread and guest heap ctest entries pass with this change. This includes guest_pthread_mutex_contention, guest_pthread_final_release_race, guest_pthread_destructor_lifetime, guest_pthread_cancel* and guest_heap_*.

  • Full ctest suite on GitHub-hosted Windows (ycbuzi, report, head 9ceb8ecf07 merged into main, WinLibs GCC 15.2.0, run): Windows Server 2025 passes all 6133 tests in both runs. Windows Server 2022 has 2 and 3 failures out of 6133; all of them also fail on main on the same runner.

  • Title: Bloodborne CUSA00900 01.09 (my own copy), on main plus the open fixes it needs (#17105, #17711, #20156, #21944; #21832 has since merged).

    • Before: 5 of 6 runs stalled as described above.
    • After: 3 of 3 runs open /data/cache.bin, load the shader bundles and reach the next stop at about 1.7 s: compute shader 0x2d1f00900: buffer specialization has an unsupported format. That stop is unrelated to this change.
  • guest_raise_released_thread (Linux only): oneandonlydean found that it aborts with this PR on head 9ceb8ecf07. The test noticed a thread object's release by replacing the global operator delete; PthreadPrivate now frees through its own operator delete into GuestHeapFree, so the test never saw the release. Head b13fbdf052 changes only the test: it interposes GuestHeapFree_nid_postfix, keeps the watched object zero-filled and unreused, and passes every other block on. WSL Ubuntu, GCC, Release, Ryzen 7 7800X3D: the old test aborts on this PR (Subprocess aborted, as reported); the new one passes 5 of 5 runs, and guest_thread_self passes 5 of 5. check_conventions.py passes.
    python3 tools/check_conventions.py --base origin/main and tools/debt_fold.py --check pass. tools/pr_overlap.py --branch could not compare 13 conflicting PRs that touch Pthread.hpp or Thread.cpp: #4563 #7149 #8592 #9938 #12642 #12682 #12688 #12700 #12965 #15040 #16790 #19181 #19453. I read their diffs. None changes how PthreadPrivate is allocated. #7149 moves thread stacks into the guest arena, which is a different object.

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: CUSA00900 Bloodborne #3094
  • GPUs tested: n/a (libkernel change; the title runs used NVIDIA GeForce RTX 4080 SUPER, driver 621.14, Windows 11 Pro 10.0.26300)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5347262239 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21969). Originally posted by [B-Howell](https://github.com/B-Howell) on 2026-11-16T23:38:57Z. --- ### What `scePthreadSelf`, `scePthreadCreate` and `pthread_self` give the title the address of its `PthreadPrivate`. That object came from the host heap. On Windows the guest arena reserves everything below `0xfc00000000` at start-up, so later host allocations land above it, and some land above 2^40. Titles keep that address in 40-bit fields. Bloodborne stalled silently in 5 of 6 runs, right after its first compute dispatch. A `APS5_HANG_DUMP_SECS=25` dump of a stalled run shows: - The main thread spins in guest code at `bloodborne.exe+0x21c8424` (`cmp 0x18(%r13),%eax; jg` back). It waits for a counter that the `GXWorker` threads raise. - `GXWorker:1` sits in `sceKernelWaitSema` (`libkernel.prx+0x5e066`), called from `bloodborne.exe+0x2046988`. That caller is the title's own adaptive mutex: its error string is `DLAdaptiveMutex::Lock logical error in dantelion2.`, from `CSPlainAdaptiveMutexImp_sce.cpp`. - `GXWorker:2` to `GXWorker:5` wait in `scePthreadMutexLock`. The mutex stores `scePthreadSelf()` masked to 40 bits (`movabs $0xffffffffff`) in its lock word. After the `cmpxchg` succeeds, it compares the masked owner with the full `scePthreadSelf()`. If they differ, it treats the lock as contended and waits on the semaphore. Its try-lock path does the same: it takes the lock and then reports failure. So a thread whose object lies above 2^40 waits forever on a lock it owns. In the stalled runs the `GXWorker` objects were at `0x0000013cdaacbc10`; in the run that got further they were at `0x000000fc094b74a0`, below 2^40. With this change they are at `0x0000000200221de0`. `PthreadPrivate` now has class `operator new` and `operator delete` backed by `GuestHeap`. That is libc's allocator for host-made objects the guest sees, already used by AvPlayer, Net and Ampr. Every `PthreadPrivate` comes from `std::make_unique` or `delete`: created threads, threads adopted by `scePthreadSelf` on Windows and on POSIX hosts, and the final release. So all of them now lie in registered guest memory. Freeing goes through `GuestHeapFree`, under the same unpinned-range rule as every other guest heap block, including the title's own `free`. An independent review asked whether `delete` of a `PthreadPrivate` can end the process, because `GuestHeapFree_nid_postfix` throws once a lease pins the block past `APS5_PIN_WAIT_MS` and `operator delete` is `noexcept`. It does not add a new risk. Leases from `GuestAllocationsAcquire_nid_postfix`/`AcquireAll` snapshot every readable registered range, not ones the GPU uses (`GuestAllocations.cpp` L794-803, L865-874), so every guest heap block is pinned the same way, and the title's own `free` (`ApplicationHeap.cpp` L41 `defaultFree`) hits the same throw with guest frames above it that cannot catch it. The block is allocated with `gpu = false` and is never handed to the GPU; the wait defaults to 60 s while the pin waiter retires GPU work, so a throw there means the GPU is already stuck. The debt fragment notes that the console's placement of these objects is not measured. The test `GuestThreadSelf.cpp` requires the main thread object, a host thread adopted through `scePthreadSelf` (Windows), and a created thread to be registered guest allocations below 2^40. ### Tested Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7, Release. - **`guest_thread_self`:** on `main` the new check aborts (exit `0xc0000409`). With this change it passes. - **Related tests:** 104 pthread, thread, kernel-sys thread and guest heap ctest entries pass with this change. This includes `guest_pthread_mutex_contention`, `guest_pthread_final_release_race`, `guest_pthread_destructor_lifetime`, `guest_pthread_cancel*` and `guest_heap_*`. - **Full ctest suite on GitHub-hosted Windows** (ycbuzi, [report](https://github.com/boykopovar/AnyPS5/pull/21969#issuecomment-6965510072), head `9ceb8ecf07` merged into main, WinLibs GCC 15.2.0, [run](https://github.com/ycbuzi/AnyPS5/actions/runs/44168628227)): Windows Server 2025 passes all 6133 tests in both runs. Windows Server 2022 has 2 and 3 failures out of 6133; all of them also fail on main on the same runner. - **Title:** Bloodborne CUSA00900 01.09 (my own copy), on `main` plus the open fixes it needs (#17105, #17711, #20156, #21944; #21832 has since merged). - Before: 5 of 6 runs stalled as described above. - After: 3 of 3 runs open `/data/cache.bin`, load the shader bundles and reach the next stop at about 1.7 s: `compute shader 0x2d1f00900: buffer specialization has an unsupported format`. That stop is unrelated to this change. - **`guest_raise_released_thread` (Linux only):** oneandonlydean [found](https://github.com/boykopovar/AnyPS5/pull/21969#issuecomment-7001040207) that it aborts with this PR on head `9ceb8ecf07`. The test noticed a thread object's release by replacing the global `operator delete`; `PthreadPrivate` now frees through its own `operator delete` into `GuestHeapFree`, so the test never saw the release. Head `b13fbdf052` changes only the test: it interposes `GuestHeapFree_nid_postfix`, keeps the watched object zero-filled and unreused, and passes every other block on. WSL Ubuntu, GCC, Release, Ryzen 7 7800X3D: the old test aborts on this PR (`Subprocess aborted`, as reported); the new one passes 5 of 5 runs, and `guest_thread_self` passes 5 of 5. `check_conventions.py` passes. `python3 tools/check_conventions.py --base origin/main` and `tools/debt_fold.py --check` pass. `tools/pr_overlap.py --branch` could not compare 13 conflicting PRs that touch `Pthread.hpp` or `Thread.cpp`: #4563 #7149 #8592 #9938 #12642 #12682 #12688 #12700 #12965 #15040 #16790 #19181 #19453. I read their diffs. None changes how `PthreadPrivate` is allocated. #7149 moves thread stacks into the guest arena, which is a different object. ### 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 - [x] Fixes: none - [x] Unblocks: CUSA00900 Bloodborne #3094 - [x] GPUs tested: n/a (libkernel change; the title runs used NVIDIA GeForce RTX 4080 SUPER, driver 621.14, Windows 11 Pro 10.0.26300) - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-16 23:42:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T23:42:09Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 9ceb8ecf07:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_thread_self_tests built cleanly.
  • CTest (guest_thread_self):
    1/1 Test #5208: guest_thread_self ................   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libkernel/Pthread/include/Pthread.hpp, core/libs/prx/libkernel/Pthread/src/Thread.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #5208: guest_thread_self ................Subprocess aborted***Exception:   0.14 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified PthreadPrivate::operator new and delete use GuestHeap::GuestHeapAlign_nid_postfix(alignof(PthreadPrivate), bytes) and GuestHeap::GuestHeapFree_nid_postfix(pointer) in Thread.cpp:632-638.
    • Verified alignment and sizing semantics: alignof(PthreadPrivate) satisfies std::max_align_t and struct field alignments, and allocation size bytes matches sizeof(PthreadPrivate).
    • Checked operator delete noexcept specification and null-pointer safety when deleting PthreadPrivate instances.
    • Verified AGENTS.md technical debt fragment docs/dev/debt/changes/fix-libkernel-pthread-objects-in-guest-memory.md format, conventions, and absence of prohibited code comments.
    • Verified GuestThreadSelf.cpp tests assert thread objects reside below 2^40 and are tracked within guest memory mappings via GuestAllocations::Mutation::Covers.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5929937296 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21969#pullrequestreview-5929937296). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-16T23:42:09Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `9ceb8ecf07`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_thread_self_tests` built cleanly. - **CTest** (`guest_thread_self`): ``` 1/1 Test #5208: guest_thread_self ................ Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libkernel/Pthread/include/Pthread.hpp`, `core/libs/prx/libkernel/Pthread/src/Thread.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #5208: guest_thread_self ................Subprocess aborted***Exception: 0.14 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - Verified PthreadPrivate::operator new and delete use GuestHeap::GuestHeapAlign_nid_postfix(alignof(PthreadPrivate), bytes) and GuestHeap::GuestHeapFree_nid_postfix(pointer) in Thread.cpp:632-638. - Verified alignment and sizing semantics: alignof(PthreadPrivate) satisfies std::max_align_t and struct field alignments, and allocation size bytes matches sizeof(PthreadPrivate). - Checked operator delete noexcept specification and null-pointer safety when deleting PthreadPrivate instances. - Verified AGENTS.md technical debt fragment docs/dev/debt/changes/fix-libkernel-pthread-objects-in-guest-memory.md format, conventions, and absence of prohibited code comments. - Verified GuestThreadSelf.cpp tests assert thread objects reside below 2^40 and are tracked within guest memory mappings via GuestAllocations::Mutation::Covers. Looks Good To Me
MarcZX10 commented 2026-11-16 23:59:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T23:59:21Z.

Review: COMMENTED


Reviewed — no blocking findings

The allocation change and the changed test are consistent with the stated goal at head 9ceb8ecf077d603c1166acd8cd4d23ebafe157a7; I found no verified blocking defect, but did not run checks.

What I ran

No commands or tests were run. I reviewed the prepared diff and targeted source context at the pinned head. The changed files listed in the manifest were all read; no excluded files were listed in the manifest. files.json was not available through the reader, so excluded-file status is not verified.

Results

Check Result Note
Diff and changed files passed Four manifest files reviewed
Tests and prechecks not run No commands run

Findings

Blocking

None.

Non-blocking

None.

Not verified

Builds, tests, conventions, debt checks, runtime behavior, and author-reported results were not independently verified. files.json was unavailable, so I could not confirm whether the bundle has additional excluded files.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5930141439 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21969#pullrequestreview-5930141439). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-16T23:59:21Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The allocation change and the changed test are consistent with the stated goal at head `9ceb8ecf077d603c1166acd8cd4d23ebafe157a7`; I found no verified blocking defect, but did not run checks. ## What I ran No commands or tests were run. I reviewed the prepared diff and targeted source context at the pinned head. The changed files listed in the manifest were all read; no excluded files were listed in the manifest. `files.json` was not available through the reader, so excluded-file status is not verified. ## Results | Check | Result | Note | |---|---|---| | Diff and changed files | passed | Four manifest files reviewed | | Tests and prechecks | not run | No commands run | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Builds, tests, conventions, debt checks, runtime behavior, and author-reported results were not independently verified. `files.json` was unavailable, so I could not confirm whether the bundle has additional excluded files. ## To get this to a good state Nothing is required.
PrivacyOnion commented 2026-11-19 16:41:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T16:41:54Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against b13fbdf052:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_raise_released_thread_tests, guest_thread_self_tests built cleanly.
  • CTest (guest_thread_self, guest_raise_released_thread):
    1/2 Test #5578: guest_thread_self ................   Passed    0.03 sec
    2/2 Test #5692: guest_raise_released_thread ......   Passed    0.03 sec
    100% tests passed, 0 tests failed out of 2
    
  • Negative control: with core/libs/prx/libkernel/Pthread/include/Pthread.hpp, core/libs/prx/libkernel/Pthread/src/Thread.cpp reverted to main and the new tests kept, the suite fails:
    1/2 Test #5578: guest_thread_self ................Subprocess aborted***Exception:   0.69 sec
    2/2 Test #5692: guest_raise_released_thread ......Subprocess aborted***Exception:   0.80 sec
    0% tests passed, 2 tests failed out of 2
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified PthreadPrivate::operator new and operator delete implementations in Thread.cpp:632-638 correctly route allocations through GuestHeap::GuestHeapAlign_nid_postfix and GuestHeap::GuestHeapFree_nid_postfix with alignof(PthreadPrivate).
    • Verified operator delete(void*) noexcept conforms to C++20 deallocation rules and safely delegates nullptr handling to GuestHeapFree_nid_postfix.
    • Verified that Pthread.hpp declares matching static operator new(std::size_t) and operator delete(void*) noexcept within struct PthreadPrivate.
    • Verified GuestRaiseReleasedThread.cpp test interception of GuestHeapFree_nid_postfix correctly forwards non-watched allocations to dlsym(RTLD_NEXT) and safely zeroes watched memory using GuestHeap::GuestHeapUsableSize_nid_postfix.
    • Verified GuestThreadSelf.cpp assertions confirm thread handles reside within the 40-bit guest arena and are tracked by GuestAllocations::Mutation::Covers across main and worker threads.
    • Verified docs/dev/debt/changes/fix-libkernel-pthread-objects-in-guest-memory.md satisfies AGENTS.md conventions for debt fragments and contains no prohibited code comments.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5979305443 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21969#pullrequestreview-5979305443). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-19T16:41:54Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `b13fbdf052`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_raise_released_thread_tests`, `guest_thread_self_tests` built cleanly. - **CTest** (`guest_thread_self`, `guest_raise_released_thread`): ``` 1/2 Test #5578: guest_thread_self ................ Passed 0.03 sec 2/2 Test #5692: guest_raise_released_thread ...... Passed 0.03 sec 100% tests passed, 0 tests failed out of 2 ``` - **Negative control**: with `core/libs/prx/libkernel/Pthread/include/Pthread.hpp`, `core/libs/prx/libkernel/Pthread/src/Thread.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/2 Test #5578: guest_thread_self ................Subprocess aborted***Exception: 0.69 sec 2/2 Test #5692: guest_raise_released_thread ......Subprocess aborted***Exception: 0.80 sec 0% tests passed, 2 tests failed out of 2 ``` Restoring the change makes it pass again. - **Code reading**: - Verified PthreadPrivate::operator new and operator delete implementations in Thread.cpp:632-638 correctly route allocations through GuestHeap::GuestHeapAlign_nid_postfix and GuestHeap::GuestHeapFree_nid_postfix with alignof(PthreadPrivate). - Verified operator delete(void*) noexcept conforms to C++20 deallocation rules and safely delegates nullptr handling to GuestHeapFree_nid_postfix. - Verified that Pthread.hpp declares matching static operator new(std::size_t) and operator delete(void*) noexcept within struct PthreadPrivate. - Verified GuestRaiseReleasedThread.cpp test interception of GuestHeapFree_nid_postfix correctly forwards non-watched allocations to dlsym(RTLD_NEXT) and safely zeroes watched memory using GuestHeap::GuestHeapUsableSize_nid_postfix. - Verified GuestThreadSelf.cpp assertions confirm thread handles reside within the 40-bit guest arena and are tracked by GuestAllocations::Mutation::Covers across main and worker threads. - Verified docs/dev/debt/changes/fix-libkernel-pthread-objects-in-guest-memory.md satisfies AGENTS.md conventions for debt fragments and contains no prohibited code comments. Looks Good To Me
Superseabas commented 2026-11-20 13:20:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-20T13:20:09Z.

Review: APPROVED


Windows check of head b13fbdf052 with GCC 16, merged onto main 0a025bd3c6 (clean merge).

Setup: Windows 11 Home 10.0.26200, Ryzen 7 7700X, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), CMake 4.4.4, Ninja 1.13.2, Release full build, run from PowerShell. This was built together with #23341 and #24190, which touch other files.

  • Thread tests (^guest_(thread|pthread|raise_released), 70 tests including guest_thread_self): main 70 of 70, and with this PR 70 of 70 in 3 of 3 runs. guest_raise_released_thread is registered for Linux only, so its dlsym(RTLD_NEXT, …) change doesn't run here.
  • Red check: with PthreadPrivate's operator new/operator delete going back to the host heap (::operator new/::operator delete), guest_thread_self aborts (0xc0000409) at the new RequireGuestObject. So the test does catch thread objects outside the guest allocations.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5993326116 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21969#pullrequestreview-5993326116). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-20T13:20:09Z. **Review:** APPROVED --- Windows check of head `b13fbdf052` with GCC 16, merged onto `main` `0a025bd3c6` (clean merge). **Setup:** Windows 11 Home 10.0.26200, Ryzen 7 7700X, WinLibs GCC 16.2.0 (`x86_64-ucrt-posix-seh`, r3), CMake 4.4.4, Ninja 1.13.2, Release full build, run from PowerShell. This was built together with #23341 and #24190, which touch other files. - **Thread tests** (`^guest_(thread|pthread|raise_released)`, 70 tests including `guest_thread_self`): `main` 70 of 70, and with this PR 70 of 70 in 3 of 3 runs. `guest_raise_released_thread` is registered for Linux only, so its `dlsym(RTLD_NEXT, …)` change doesn't run here. - **Red check:** with `PthreadPrivate`'s `operator new`/`operator delete` going back to the host heap (`::operator new`/`::operator delete`), `guest_thread_self` aborts (`0xc0000409`) at the new `RequireGuestObject`. So the test does catch thread objects outside the guest allocations. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-23 02:16:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T02:16:39Z.

Review: COMMENTED


Reviewed — no blocking findings

The change is coherent at head b13fbdf052ef1f77ee048b89ac6164a24129bee4; no blocking defect was verified, but checks were not run in this review.

What I ran

Inspected the prepared diff and all five changed files, plus the allocator and thread creation/adoption code they touch. No test or build commands were run.

Results

Check Result Note
Changed-file review passed All five changed files read
Tests and build not run Results in the PR description are author-reported
Negative control not run Not run in this review

Negative Control

Could not run a negative control in this review.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

No build or tests were run. The PR description’s reported test results were not independently verified. All files marked reviewed in the manifest were read; no changed files were excluded.

To get this to a good state

Nothing is required. Optional: run the project checks on this head before merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6015865921 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21969#pullrequestreview-6015865921). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T02:16:39Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The change is coherent at head `b13fbdf052ef1f77ee048b89ac6164a24129bee4`; no blocking defect was verified, but checks were not run in this review. ## What I ran Inspected the prepared diff and all five changed files, plus the allocator and thread creation/adoption code they touch. No test or build commands were run. ## Results | Check | Result | Note | |---|---|---| | Changed-file review | passed | All five changed files read | | Tests and build | not run | Results in the PR description are author-reported | | Negative control | not run | Not run in this review | ## Negative Control Could not run a negative control in this review. ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [Thread object allocation change](https://github.com/boykopovar/AnyPS5/blob/b13fbdf052ef1f77ee048b89ac6164a24129bee4/core/libs/prx/libkernel/Pthread/src/Thread.cpp) - [Guest heap free behavior](https://github.com/boykopovar/AnyPS5/blob/b13fbdf052ef1f77ee048b89ac6164a24129bee4/core/libs/prx/libc/src/GuestHeap.cpp) ## Not verified No build or tests were run. The PR description’s reported test results were not independently verified. All files marked reviewed in the manifest were read; no changed files were excluded. ## To get this to a good state Nothing is required. Optional: run the project checks on this head before merging.
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!21969
No description provided.