fix(libkernel): clear the thread handle when scePthreadCreate rejects a long name as measured on a PS5 #11201
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11201"
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 orezraey on 2026-10-25T21:45:47Z.
What
scePthreadCreatenow sets the thread handle to 0 when it rejects a name of 32 bytes or more withENAMETOOLONG, as a retail PS5 (firmware 13.60) does. Before, it left the handle as it was. Measured with a homebrew probe from a payload process; the source and console log are in this gist (pthrname2).On the console, a handle pre-filled with
0xDEADBEEF:0x8002003f;The debt entry said whether the handle is written before the name check was not measured; it now records the result. Whether the console clears the handle on other errors was not measured, so only the name check changes.
Before and after
scePthreadCreate, handle pre-filled with0xDEADBEEF0x8002003f, handle 00x8002003f, handle0xDEADBEEF0x8002003f, handle 0Tested
Windows 11, WinLibs GCC 15.2, full build. The 31 tests matching
pthread|thread_name|second_joinpass 3 times out of 3.guest_pthread_second_joinchecks that a handle pre-filled with 0x77 reads null after a 32-byte and a 33-byte name.tools/check_conventions.pypasses.Code and tests at
3836941fb2onmain9c6d153dec; head3a2638ada6only adds a debt note onpthread_create_name_np, so the tests were not rerun.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-25T21:48:50Z.
Review: APPROVED
Reviewed head
3836941fb248bcff5af158efdfc71dade27bb71f. The linked PS5 probe log directly shows a 31-byte name succeeds and 32-/33-byte names return0x8002003fwith the output handle cleared. The updated regression test covers those same boundary cases and retains the 31-byte success check. The implementation clears the handle only on the measured long-name error path. Localcheck_conventions.pyandgit diff --checkpass. The Windows full-build/test run is author-reported; hosted product builds are skipped. I found no remaining correctness issue in this change.