fix(libkernel): return ESRCH from signalto for a handle that is not a thread #13832
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13832"
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 zaryabzip on 2026-10-31T08:44:34Z.
What
scePthreadCondSignaltoandpthread_cond_signalto_npreturnedEPERMfor a handle that is not a thread. A PS5 returnsESRCHthere. @orezraey measured it in a payload process on firmware 13.60 (probe and log, from #11263):scePthreadCondSignaltopthread_cond_signalto_npmainbefore0x800200160x123450x800200030x80020001/ 10x80020001The debt entry already recorded the difference. The new check sits between the null check and the not-waiting check, as the console orders them. It uses
GuestThreadIsLive, the lookuppthread_getprio,sched_setparamandpthread_setaffinity_npalready use to answerESRCH. It compares the handle with the registered threads without dereferencing it. A thread that has finished but hasn't been joined wasn't tried on the console; like those calls, it now getsESRCHhere, and the debt entry says so. No function changes count.GuestCondTimedwait.cpp'sSignalTo()adds the0x12345case for both exports. Its existing checks still requireEPERMfor the calling thread, which isn't waiting.Overlap: #13725 also changes
Cond.cppand the debt line above, in other places;git merge-treemerges the two cleanly.Tested
Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), both with the head
0a5c3be283merged intomaine8c25dd3ba.Cond.cpporGuestCondTimedwait.cpp.ctest -R "cond|pthread" -E "^agc_|^secondary_output": 69 of 69 pass on both hosts, covering theguest_cond_*,guest_pthread_*,guest_kernel_sys_pthread*andguest_ult_condition_*tests.guest_cond_timedwaitpasses 3 of 3 on--repeat until-fail:3. The existing checks that the calling thread getsEPERMstill pass.mainwith only the test change,guest_cond_timedwaitbuilds and then aborts at the first0x12345check (line 153), wheremainreturnsEPERM(Windows exit 0xc0000409, Linux SIGABRT).tools/check_conventions.pypasses.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)