fix(libkernel): return EBUSY when destroying a held rwlock #2978
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2978"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T19:21:33Z.
What
Fixes #2836. Track active readers and check both reader and writer ownership before deleting a rwlock. Return
SCE_KERNEL_ERROR_EBUSYand preserve the handle while a lock remains held; add SCE and POSIX regression coverage for local and remote readers/writers, failed acquisitions, and writer handoff.This carries the issue-linked change authored by Zayd Zaari; the original commit author is preserved. Concurrent destruction with a simultaneous acquisition remains outside this fix.
Tested
Linux, GCC 12.2.0, Release: rebuilt
libkernel.prxandguest_pthread_rwlock_testsfrom the existing configured build tree.guest_pthread_rwlockpassed 10 consecutive runs. Conventions, diff checks, and the open-PR overlap check passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T20:53:26Z.
Windows validation of the current head
8c790001merged ontomain56fb1b3b.Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build including thelibstarget.guest_pthread_rwlockpasses 3/3 (--repeat until-fail:3).ctest -j8 -E "^agc_|video_out"passes 388/388.main'sRwlock.cppandPthread.hppand this PR's test,guest_pthread_rwlockaborts, so the coverage detects the previous behaviour.Validation run with Claude Code assistance.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T23:39:42Z.
Checked the held-reader/held-writer destroy paths, the new SCE and POSIX tests (they fail without the change) and the rebase onto current main; thanks @screamm for the Windows run.
Added in our commit:
TechnicalDebt.md:EBUSYon destroy of a held rwlock follows KytyPS5; FreeBSD libthr and shadPS4 free without checking and the console's answer is unverified. Destroying while another thread is acquiring is documented as unguarded.Merging once CI is green.