fix(libkernel): return the console's errors from the scePthreadAttr calls #4153
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4153"
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 hugodearaujo on 2026-10-12T00:06:15Z.
What
The
scePthreadAttrsetters and getters threw on a null or uninitialized attribute, threw on an invalid detach state, and stored any policy, inheritance and priority. I called the console's exports from a homebrew payload on a PS5 (firmware 13.60):mainEINVAL(0x80020016)scePthreadAttrDestroy, null or zeroed attributeEINVALGetstacksize,Getdetachstate,Getschedparam, null outputEINVALSetstacksizebelow 16384EINVALEINVALSetdetachstateother than 0 and 1EINVALSetschedpolicyother than 1 (SCHED_FIFO) and 3 (SCHED_RR)ENOTSUP(0x8002002D)Setinheritschedother than 0 (explicit) and 4 (inherit)ENOTSUPSetschedparampriority outside 256 to 767, or a null parameterENOTSUPSetaffinity, any maskValues tried: stack sizes 0, 1, 16383, 16384, 0x10000 and 2^47 - 1; detach states -1 to 3 and 100; policies and inheritances -1 to 4 and 8; priorities -1, 0, 255, 256, 767, 768, 900 and 960; masks 0, 1, 0x7f, 0xff, 0x100 and all bits. Unlike
pthread_setschedparamon a thread, the attribute rejects 896 to 959.So these calls now return those errors. Two cases still throw because the console crashed the payload on them: a null pointer to
scePthreadAttrInitand a null output toscePthreadAttrGetaffinity. A new attribute's 64 KiB default stack size on the console is not copied; the host code that runs on guest threads needs the current 1 MiB. TechnicalDebt has a new entry for all of this.Titles: Hollow Knight: Silksong (PPSA12544) and Hades (PPSA03355) import these calls. Silksong checks the result of each one and gives up creating the thread when it is non-zero (
eboot.bin0xadd93b,0x17264d4,0x1bbe95c); the values it passes (policies 1 and 3, explicit inheritance, priorities 0x100, 0x104 and 0x109) are accepted both on the console and here.libSceJobManagerbuilds worker attributes with priorities it has already checked against 0x100 to 0x2ff, so it is unaffected.Tested
guest_pthread_attr_errorscovers each row; it aborts onmain.guest_pthread_attr_errorsandguest_pthread_attrpass.agc_write_trackingandguest_kernel_stack_protectfail the same way on currentmainin this VM.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 repository (attach them to this PR)🤖 Generated with Claude Code