fix(libkernel): notify rwlock waiters before unlocking state #6711

Merged
Ondra97 merged 2 commits from upstream-pr/6711 into main 2026-10-19 09:03:07 +00:00
Ondra97 commented 2026-10-16 06:12:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-16T06:12:37Z.


What

A thread releasing a PS5 read/write lock could release its internal mutex before notifying waiters. A successor could acquire the lock, release it and destroy it while the first thread was still calling NotifyAll on the freed object. The same lifetime gap existed after a timed writer stopped waiting. I now finish each notification while the internal mutex still protects the object.

The regression covers 2,000 reader-to-writer and 2,000 writer-to-writer handoffs per run. It waits for the successor's readiness with atomic::wait and a matching notification, and yields after an unsuccessful Trywrlock. After acquiring the lock, the successor still immediately unlocks and destroys it, preserving the lifetime race. The 20-second timeout is unchanged.

The requirement to finish wakeups before a successor can destroy a read/write lock is also described in the glibc implementation.

Comparison Before After
Lifetime race: same updated test, original versus fixed Rwlock.cpp, Windows (native host) 1/1 run failed with std::system_error 20/20 runs passed
Single CPU: original versus updated test, same fixed Rwlock.cpp, Windows (native host) 1/1 run timed out at 20.06 s 20/20 runs passed, 0.03-0.12 s per run
Single CPU: original versus updated test, same fixed Rwlock.cpp, Linux (VirtualBox VM) 1/1 run timed out at 20.69 s 20/20 runs passed
Lifetime race: same updated test, original versus fixed Rwlock.cpp, Linux (VirtualBox VM), AddressSanitizer 1/1 run reported heap-use-after-free 100/100 runs passed

The production baseline is main 5d9dcc42d2ec5401aebd089028b8d4d7410a77b4. The updated PR head is 915e9f2d5d223a16e3f21d9ad52c18ecfd41c532. Full builds use integration commit 339ee7999e82b1cbb51d01c6239d37c8a556583b, which adds only #6452's AGC test fixture correction needed by the supported Windows toolchain. That dependency is outside this PR. For each lifetime comparison, only production Rwlock.cpp was replaced; the updated regression stayed identical.

Tested

  • Windows (native host): Windows 11 Pro build 26300, AMD Ryzen 9 7900X, NVIDIA GeForce RTX 4070 Ti SUPER (driver 32.0.16.1742; graphics not exercised), WinLibs GCC 15.2.0, Release with BUILD_TESTING=ON. Full default build passed, including patched libraries. The ten kernel synchronization/thread tests below passed with zero skips. The updated regression passed 20 additional normal runs and 20 runs with process affinity restricted to one logical CPU. Restoring the original Rwlock.cpp reproduced the lifetime failure; the fixed file was restored and libkernel rebuilt before the final passing tests.
ctest --test-dir build-runtime -R '^guest_(pthread_rwlock|rwlock_retire|pthread_cancel.*|semaphore|sync_on_address|kernel_sync|once|pthread_barrier)$' --output-on-failure --parallel 3
ctest --test-dir build-runtime -R '^guest_rwlock_retire$' --output-on-failure --repeat until-fail:20

On Windows, I restricted the parent test process to affinity mask 1 for the single-CPU comparison; its child CTest/test processes inherited that restriction.

  • Linux (VirtualBox VM): Ubuntu 24.04.5 LTS, kernel 7.0.0-31-generic, VirtualBox 7.2.20 on the Windows host, 8 vCPUs, 8 GiB RAM, GCC 13.3.0, graphics not exercised. A separate checkout on the VM's Linux filesystem at integration commit 339ee7999e82b1cbb51d01c6239d37c8a556583b passed the full default Release build with BUILD_TESTING=ON, including patched libraries. The same ten selected non-graphics kernel tests passed with zero failures and zero skips. The updated regression passed 20 additional runs normally and 20 with taskset -c 0. The previous test version, run with the same fixed Rwlock.cpp under the one-CPU restriction, timed out at 20.69 s.
  • Linux (VirtualBox VM), AddressSanitizer: A separate RelWithDebInfo build with the existing -DANYPS5_ENABLE_ASAN=ON option built the regression and its dependent libraries. With the original Rwlock.cpp from main and the updated test, the first run reported heap-use-after-free. I restored the fixed file, rebuilt libkernel, and observed 100/100 passing normal runs and 20/20 with taskset -c 0. ASAN_OPTIONS=detect_leaks=0:halt_on_error=1 focused this check on invalid memory access. The production file and test hashes matched the validated integration source at the end; the Linux source checkout was clean.
ctest --test-dir build -R '^guest_(pthread_rwlock|rwlock_retire|pthread_cancel.*|semaphore|sync_on_address|kernel_sync|once|pthread_barrier)$' --output-on-failure --parallel 3
ctest --test-dir build -R '^guest_rwlock_retire$' --output-on-failure --repeat until-fail:20
taskset -c 0 ctest --test-dir build -R '^guest_rwlock_retire$' --output-on-failure --repeat until-fail:20
cmake --build build-asan-review --target guest_rwlock_retire_tests --parallel 4
ASAN_OPTIONS=detect_leaks=0:halt_on_error=1 ctest --test-dir build-asan-review -R '^guest_rwlock_retire$' --output-on-failure --repeat until-fail:100

On a regular Linux build, this race can pass without a visible failure. A passing unsanitized run alone does not establish protection against a future lifetime regression. The independent native Linux review covers the previous head f2b4a71aedd082c90916c7b0464496e36c5a89ce; those are the reviewer's measurements.

Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox VM validation. Native/bare-metal Linux was not tested by me. Native Linux GPU validation: not tested. No title or homebrew was run. Full hosted PR builds require collaborator dispatch under CONTRIBUTING.md; skipped jobs do not establish a build result.

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
  • 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: #6452
  • Unblocks: none
  • GPUs tested: n/a (kernel synchronization only)
  • AI-assisted: yes — Codex. Automated validation was run by Codex; I remain responsible for the contribution.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4884297805 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6711). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-16T06:12:37Z. --- ### What A thread releasing a PS5 read/write lock could release its internal mutex before notifying waiters. A successor could acquire the lock, release it and destroy it while the first thread was still calling `NotifyAll` on the freed object. The same lifetime gap existed after a timed writer stopped waiting. I now finish each notification while the internal mutex still protects the object. The regression covers 2,000 reader-to-writer and 2,000 writer-to-writer handoffs per run. It waits for the successor's readiness with `atomic::wait` and a matching notification, and yields after an unsuccessful `Trywrlock`. After acquiring the lock, the successor still immediately unlocks and destroys it, preserving the lifetime race. The 20-second timeout is unchanged. The requirement to finish wakeups before a successor can destroy a read/write lock is also described in the [glibc implementation](https://raw.githubusercontent.com/bminor/glibc/master/nptl/pthread_rwlock_common.c). | Comparison | Before | After | | --- | --- | --- | | Lifetime race: same updated test, original versus fixed `Rwlock.cpp`, Windows (native host) | 1/1 run failed with `std::system_error` | 20/20 runs passed | | Single CPU: original versus updated test, same fixed `Rwlock.cpp`, Windows (native host) | 1/1 run timed out at 20.06 s | 20/20 runs passed, 0.03-0.12 s per run | | Single CPU: original versus updated test, same fixed `Rwlock.cpp`, Linux (VirtualBox VM) | 1/1 run timed out at 20.69 s | 20/20 runs passed | | Lifetime race: same updated test, original versus fixed `Rwlock.cpp`, Linux (VirtualBox VM), AddressSanitizer | 1/1 run reported `heap-use-after-free` | 100/100 runs passed | The production baseline is `main` `5d9dcc42d2ec5401aebd089028b8d4d7410a77b4`. The updated PR head is `915e9f2d5d223a16e3f21d9ad52c18ecfd41c532`. Full builds use integration commit `339ee7999e82b1cbb51d01c6239d37c8a556583b`, which adds only #6452's AGC test fixture correction needed by the supported Windows toolchain. That dependency is outside this PR. For each lifetime comparison, only production `Rwlock.cpp` was replaced; the updated regression stayed identical. ### Tested - Windows (native host): Windows 11 Pro build 26300, AMD Ryzen 9 7900X, NVIDIA GeForce RTX 4070 Ti SUPER (driver 32.0.16.1742; graphics not exercised), WinLibs GCC 15.2.0, Release with `BUILD_TESTING=ON`. Full default build passed, including patched libraries. The ten kernel synchronization/thread tests below passed with zero skips. The updated regression passed 20 additional normal runs and 20 runs with process affinity restricted to one logical CPU. Restoring the original `Rwlock.cpp` reproduced the lifetime failure; the fixed file was restored and `libkernel` rebuilt before the final passing tests. ```sh ctest --test-dir build-runtime -R '^guest_(pthread_rwlock|rwlock_retire|pthread_cancel.*|semaphore|sync_on_address|kernel_sync|once|pthread_barrier)$' --output-on-failure --parallel 3 ctest --test-dir build-runtime -R '^guest_rwlock_retire$' --output-on-failure --repeat until-fail:20 ``` On Windows, I restricted the parent test process to affinity mask `1` for the single-CPU comparison; its child CTest/test processes inherited that restriction. - Linux (VirtualBox VM): Ubuntu 24.04.5 LTS, kernel 7.0.0-31-generic, VirtualBox 7.2.20 on the Windows host, 8 vCPUs, 8 GiB RAM, GCC 13.3.0, graphics not exercised. A separate checkout on the VM's Linux filesystem at integration commit `339ee7999e82b1cbb51d01c6239d37c8a556583b` passed the full default Release build with `BUILD_TESTING=ON`, including patched libraries. The same ten selected non-graphics kernel tests passed with zero failures and zero skips. The updated regression passed 20 additional runs normally and 20 with `taskset -c 0`. The previous test version, run with the same fixed `Rwlock.cpp` under the one-CPU restriction, timed out at 20.69 s. - Linux (VirtualBox VM), AddressSanitizer: A separate `RelWithDebInfo` build with the existing `-DANYPS5_ENABLE_ASAN=ON` option built the regression and its dependent libraries. With the original `Rwlock.cpp` from `main` and the updated test, the first run reported `heap-use-after-free`. I restored the fixed file, rebuilt `libkernel`, and observed 100/100 passing normal runs and 20/20 with `taskset -c 0`. `ASAN_OPTIONS=detect_leaks=0:halt_on_error=1` focused this check on invalid memory access. The production file and test hashes matched the validated integration source at the end; the Linux source checkout was clean. ```sh ctest --test-dir build -R '^guest_(pthread_rwlock|rwlock_retire|pthread_cancel.*|semaphore|sync_on_address|kernel_sync|once|pthread_barrier)$' --output-on-failure --parallel 3 ctest --test-dir build -R '^guest_rwlock_retire$' --output-on-failure --repeat until-fail:20 taskset -c 0 ctest --test-dir build -R '^guest_rwlock_retire$' --output-on-failure --repeat until-fail:20 cmake --build build-asan-review --target guest_rwlock_retire_tests --parallel 4 ASAN_OPTIONS=detect_leaks=0:halt_on_error=1 ctest --test-dir build-asan-review -R '^guest_rwlock_retire$' --output-on-failure --repeat until-fail:100 ``` On a regular Linux build, this race can pass without a visible failure. A passing unsanitized run alone does not establish protection against a future lifetime regression. The independent [native Linux review](https://github.com/boykopovar/AnyPS5/pull/6711#pullrequestreview-5543972351) covers the previous head `f2b4a71aedd082c90916c7b0464496e36c5a89ce`; those are the reviewer's measurements. Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox VM validation. Native/bare-metal Linux was not tested by me. Native Linux GPU validation: not tested. No title or homebrew was run. Full hosted PR builds require collaborator dispatch under `CONTRIBUTING.md`; skipped jobs do not establish a build result. ### 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) - [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: #6452 - [x] Unblocks: none - [x] GPUs tested: n/a (kernel synchronization only) - [x] AI-assisted: yes — Codex. Automated validation was run by Codex; I remain responsible for the contribution.
jotitadev commented 2026-10-16 06:44:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T06:44:34Z.

Review: COMMENTED


Native Linux run on exact head f2b4a71aedd082c90916c7b0464496e36c5a89ce, applied on main 5d9dcc42d (no other PR needed on Linux).

Machine: Intel i7-8700 (6C/12T), Ubuntu 26.04, GCC 15.2, Ninja Release, BUILD_TESTING=ON, full build.

  • The ten tests from the description (^guest_(pthread_rwlock|rwlock_retire|pthread_cancel.*|semaphore|sync_on_address|kernel_sync|once|pthread_barrier)$): 10/10 pass. guest_rwlock_retire with --repeat until-fail:20: 20/20.
  • Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out"): 649/651, same as main (648/650) plus the new test. The two failures (file_writer_binary, file_writer_text) also fail on main on this machine.

The regression test does not catch the bug on a plain Linux build. With only the test applied to main (original Rwlock.cpp), guest_rwlock_retire passed 200/200 under --repeat until-fail:200. On glibc, NotifyAll on the freed object locks a std::mutex in memory that was just freed but not yet reused, so nothing faults. It is a real use-after-free, though. I built the test with Rwlock.cpp and TimedWait.cpp under AddressSanitizer (g++ -fsanitize=address):

  • Original Rwlock.cpp: 20/20 runs report heap-use-after-free in TimedWait::Condition::NotifyAll() called from scePthreadRwlockUnlock (Rwlock.cpp:159). The memory was freed by scePthreadRwlockDestroy on the successor thread.
  • This PR's Rwlock.cpp: 100/100 clean.

So the fix is confirmed on Linux too, but the test only fails on Windows (or under a sanitizer). Linux CI will not catch a regression.

A smaller point: both threads busy-wait (while (phase.load() == 1) {} and the Trywrlock loop). Pinned to one core (taskset -c 0), the test with the fix took 23.9 s, over the test's TIMEOUT 20. On 12 threads it takes 0.02 s. Waiting on phase instead of spinning would avoid that on a 1-vCPU VM or runner.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5543972351 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6711#pullrequestreview-5543972351). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T06:44:34Z. **Review:** COMMENTED --- Native Linux run on exact head `f2b4a71aedd082c90916c7b0464496e36c5a89ce`, applied on `main` `5d9dcc42d` (no other PR needed on Linux). Machine: Intel i7-8700 (6C/12T), Ubuntu 26.04, GCC 15.2, Ninja Release, `BUILD_TESTING=ON`, full build. - The ten tests from the description (`^guest_(pthread_rwlock|rwlock_retire|pthread_cancel.*|semaphore|sync_on_address|kernel_sync|once|pthread_barrier)$`): 10/10 pass. `guest_rwlock_retire` with `--repeat until-fail:20`: 20/20. - Non-GPU suite (`ctest -E "^agc|gpu|vulkan|video_out"`): 649/651, same as `main` (648/650) plus the new test. The two failures (`file_writer_binary`, `file_writer_text`) also fail on `main` on this machine. **The regression test does not catch the bug on a plain Linux build.** With only the test applied to `main` (original `Rwlock.cpp`), `guest_rwlock_retire` passed 200/200 under `--repeat until-fail:200`. On glibc, `NotifyAll` on the freed object locks a `std::mutex` in memory that was just freed but not yet reused, so nothing faults. It is a real use-after-free, though. I built the test with `Rwlock.cpp` and `TimedWait.cpp` under AddressSanitizer (`g++ -fsanitize=address`): - Original `Rwlock.cpp`: 20/20 runs report `heap-use-after-free` in `TimedWait::Condition::NotifyAll()` called from `scePthreadRwlockUnlock` (Rwlock.cpp:159). The memory was freed by `scePthreadRwlockDestroy` on the successor thread. - This PR's `Rwlock.cpp`: 100/100 clean. So the fix is confirmed on Linux too, but the test only fails on Windows (or under a sanitizer). Linux CI will not catch a regression. A smaller point: both threads busy-wait (`while (phase.load() == 1) {}` and the `Trywrlock` loop). Pinned to one core (`taskset -c 0`), the test with the fix took 23.9 s, over the test's `TIMEOUT 20`. On 12 threads it takes 0.02 s. Waiting on `phase` instead of spinning would avoid that on a 1-vCPU VM or runner. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
github-actions[bot] commented 2026-10-16 06:49:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T06:49:14Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4972 core/libs/prx/libkernel/CMakeLists.txt
PR 5021 core/libs/prx/libkernel/CMakeLists.txt
PR 6044 core/libs/prx/libkernel/CMakeLists.txt
PR 6226 core/libs/prx/libkernel/CMakeLists.txt
PR 6469 core/libs/prx/libkernel/CMakeLists.txt
PR 6825 core/libs/prx/libkernel/CMakeLists.txt
PR 6908 core/libs/prx/libkernel/CMakeLists.txt
PR 6936 core/libs/prx/libkernel/CMakeLists.txt
PR 6942 core/libs/prx/libkernel/CMakeLists.txt
PR 6977 core/libs/prx/libkernel/CMakeLists.txt
PR 7129 core/libs/prx/libkernel/CMakeLists.txt
PR 7192 core/libs/prx/libkernel/CMakeLists.txt
PR 7201 core/libs/prx/libkernel/CMakeLists.txt
PR 7299 core/libs/prx/libkernel/CMakeLists.txt
PR 7332 core/libs/prx/libkernel/CMakeLists.txt
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6209825623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6711#issuecomment-6209825623). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T06:49:14Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 4972](https://www.github.com/boykopovar/AnyPS5/pull/4972) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6226](https://www.github.com/boykopovar/AnyPS5/pull/6226) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6469](https://www.github.com/boykopovar/AnyPS5/pull/6469) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6825](https://www.github.com/boykopovar/AnyPS5/pull/6825) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6908](https://www.github.com/boykopovar/AnyPS5/pull/6908) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6936](https://www.github.com/boykopovar/AnyPS5/pull/6936) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6942](https://www.github.com/boykopovar/AnyPS5/pull/6942) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7129](https://www.github.com/boykopovar/AnyPS5/pull/7129) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7192](https://www.github.com/boykopovar/AnyPS5/pull/7192) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7299](https://www.github.com/boykopovar/AnyPS5/pull/7299) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libkernel/CMakeLists.txt` |
Ondra97 commented 2026-10-16 08:53:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-16T08:53:21Z.


@jotitadev Thanks for the native Linux checks and the single-core reproducer.

I addressed the spinning in 915e9f2d5: the phase handshake now uses atomic::wait with a matching notification, and the Trywrlock loop yields after EBUSY. The successor still immediately unlocks and destroys the acquired lock, preserving the lifetime race.

I reproduced the original test's single-CPU timeout on Windows (20.06 s) and Linux (VirtualBox VM, 20.69 s). The updated test passed 20/20 single-CPU runs in each environment; Windows runs took 0.03-0.12 s.

With the existing ANYPS5_ENABLE_ASAN=ON configuration in Linux (VirtualBox VM), the updated test reported heap-use-after-free against the original Rwlock.cpp. The fixed implementation passed 100/100 normal runs and 20/20 single-CPU runs. Full builds and all ten selected kernel tests also passed on Windows and Linux (VirtualBox VM), using integration commit 339ee7999e82b1cbb51d01c6239d37c8a556583b (this head plus #6452's AGC test fixture correction).

I updated the PR description with the comparisons and commands, including the limitation that an unsanitized Linux pass does not reliably detect this regression.

AI-assisted: yes — Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6211834284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6711#issuecomment-6211834284). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-16T08:53:21Z. --- @jotitadev Thanks for the native Linux checks and the single-core reproducer. I addressed the spinning in 915e9f2d5: the phase handshake now uses `atomic::wait` with a matching notification, and the `Trywrlock` loop yields after `EBUSY`. The successor still immediately unlocks and destroys the acquired lock, preserving the lifetime race. I reproduced the original test's single-CPU timeout on Windows (20.06 s) and Linux (VirtualBox VM, 20.69 s). The updated test passed 20/20 single-CPU runs in each environment; Windows runs took 0.03-0.12 s. With the existing `ANYPS5_ENABLE_ASAN=ON` configuration in Linux (VirtualBox VM), the updated test reported `heap-use-after-free` against the original `Rwlock.cpp`. The fixed implementation passed 100/100 normal runs and 20/20 single-CPU runs. Full builds and all ten selected kernel tests also passed on Windows and Linux (VirtualBox VM), using integration commit `339ee7999e82b1cbb51d01c6239d37c8a556583b` (this head plus #6452's AGC test fixture correction). I updated the PR description with the comparisons and commands, including the limitation that an unsanitized Linux pass does not reliably detect this regression. AI-assisted: yes — Codex.
adriadam10 commented 2026-10-19 09:04:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T09:04:01Z.


Checked the Rwlock.cpp change by reading: NotifyAll now completes while _state is held in both scePthreadRwlockUnlock and the timed-writer timeout path, so a successor (whose Trywrlock/Wrlock needs _state) cannot destroy the lock mid-notify. The regression test is registered in ctest, uses std::abort (effective in Release) and no longer spins. Merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6263612421 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6711#issuecomment-6263612421). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T09:04:01Z. --- Checked the `Rwlock.cpp` change by reading: `NotifyAll` now completes while `_state` is held in both `scePthreadRwlockUnlock` and the timed-writer timeout path, so a successor (whose `Trywrlock`/`Wrlock` needs `_state`) cannot destroy the lock mid-notify. The regression test is registered in ctest, uses `std::abort` (effective in Release) and no longer spins. Merged.
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!6711
No description provided.