fix(libkernel): store only rwlock attribute types 1 and 2 #10173
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10173"
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 EagleBearerYS on 2026-10-23T12:01:35Z.
What
scePthreadRwlockattrSettypestores only types 1 and 2. Any other type, 0 included, and a null attribute or object returnSCE_KERNEL_ERROR_EINVALand store nothing. Onmainit stores any type and throws on a null attribute.The answers come from BunnyFl's measurements of firmware 13.42's
libkernelandlibkernel_sys, run in an emulator. There,scePthreadRwlockattrSettypeis the same function aspthread_rwlockattr_settype_np, with a non-zero result turned into0x80020000 + errno: types 1 and 2 are stored, and every other type (0, 3, -1 and0x80000000were tried) and a null attribute or object returnEINVAL, so0x80020016here.The stored type is still not applied:
scePthreadRwlockInitignores its attribute, as before. #9632 takes the same measurement forpthread_rwlockattr_settype_np, which forwards types 1 and 2 to this function; the two PRs touch different files.Tested
guest_pthread_rwlock, newCheckAttrSettype: types 1 and 2 returnSCE_OKand a rwlock made from the attribute locks and unlocks; types 0, 3, -1 and0x80000000, a destroyed attribute and a null attribute returnSCE_KERNEL_ERROR_EINVAL.main777bdbb4f8's code (run): on Linux and on Windows, 1 of the 2 tests passes, none skipped.guest_pthread_rwlockfails on both, aborting on Linux and exiting with0xc0000409on Windows;guest_rwlock_retirepasses 10 runs in a row.guest_pthread_rwlockandguest_rwlock_retirepass 10 runs in a row, 2 of 2, none skipped or failed. The libc and libkernel suites run 118 and 200 tests on Linux and 145 and 210 on Windows, none failing, run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.check_conventions.pypasses, with no comment lines added.49b6188c63, a merge ofmain3fcb5e4d76. The only conflict wastests/GuestPthreadRwlock.cpp, where #8373 addedCheckAttrTypenext to this PR'sCheckAttrSettype: both are kept, andCheckAttrType's type loop is now{1, 2}(see Overlap). TheRwlock.cppchange is unchanged. On GitHub's runners (run),guest_pthread_rwlockpasses 10 runs in a row on Linux and on Windows, 1 of 1, none skipped or failed. The libc and libkernel suites run 142 and 204 tests on Linux and 169 and 217 on Windows, none failing, run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.Overlap: checked with
git merge-treeagainst the open PRs touching these files.CheckAttrTypeset type 0 throughscePthreadRwlockattrSettypeand expectedSCE_OK, which the measurement above refuses. This PR's merge ofmainkeeps both check functions and drops type 0 from that function's{1, 2, 0}loop, as planned here. Type 0'sSCE_KERNEL_ERROR_EINVALis checked inCheckAttrSettype, and the initial type 0 afterpthread_rwlockattr_initstays as #8373 checks it.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T12:36:13Z.
Review: APPROVED
Reviewed exact head
dd5a4a3e5a515ab33ec9636b93532aca42a0dd88. The measured 1/2 range is enforced before writing the attribute, invalid and destroyed/null attributes are covered, and the valid-type test exercises a lock/unlock using the stored attribute. The PR documents the firmware/emulator evidence, the un-applied stored type limitation, and the merge-order-only test conflict with #8373. The author reports the focused rwlock and dependent suites passing 10x on Linux and Windows; current hosted eligibility, intake, conventions, labels and report checks pass. Runtime jobs were skipped by path policy, so I did not treat those as a hosted build result.