Repository navigation
fix(libkernel): check and keep the scheduling policy of a thread - #4086
Merged
adriadam10 merged 1 commit intoOct 13, 2026
Merged
Conversation
10 tasks done
On a PS5 (firmware 13.60) pthread_setschedparam and scePthreadSetschedparam accept only SCHED_FIFO and SCHED_RR with a priority of 256 to 767 or 896 to 959, return EINVAL otherwise, and keep the policy for pthread_getschedparam. A created thread takes the policy of explicit scheduling attributes, or its creator's when it inherits. Here any policy and priority were accepted and SCHED_FIFO was always reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Rebased onto current |
adriadam10
force-pushed
the
fix/setschedparam-console
branch
from
October 13, 2026 10:55
0b95cb6 to
5c6a9d2
Compare
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follows #4077, which fixed
sched_get_priority_max/minand left this in TechnicalDebt:pthread_setschedparamandscePthreadSetschedparamignored the policy and stored any priority, andpthread_getschedparamalways reportedSCHED_FIFO. I called the console's exports from a homebrew payload on a PS5 (firmware 13.60), on a created thread:setschedparam(self, policy, priority)mainSCHED_FIFO(1) orSCHED_RR(3), priority 256 to 767INT_MAXEINVAL, nothing changesSCHED_OTHER), 4EINVAL, nothing changesgetschedparamafterSCHED_RRwas setBoth APIs answer the same (
0x80020016for the SCE one, 22 for the POSIX one). A thread created with explicit scheduling attributes starts with the attributes' policy (SCHED_RRgives 3); one that inherits starts with its creator's (1 here, even when the attributes saySCHED_RR).So both set calls now check the policy and the priority and keep the policy, both get calls report it, and
scePthreadCreatesets it from the attributes or the creator. A null parameter still returnsEINVAL; on the console it crashed the payload.Title: Propagation: Paradise Hotel (PPSA15878) calls
pthread_setschedparamfrom three places ineboot.bin: withSCHED_FIFOand a priority from the engine (0xffe6b3), and twice with the policypthread_getschedparamreported (0xffebe2, and0x4b75df0, the priority mapping described in #4077). It ignores the result.What is still different is in TechnicalDebt: a created thread that inherits scheduling takes the priority of its attributes, where the console gives it its creator's (measured: 700 with the attributes at 300).
Tested
SCHED_FIFO, and four attribute combinations at creation.guest_pthread_schedparamcovers the accepted bands and their edges, the rejected policies, both APIs, the policy kept afterSCHED_RR, and the policy of created threads; it aborts onmain.maindoes not build on Windows (HostPollinSocket.cpp, fixed by fix(libkernel): restore Windows select build for Demons Souls testing #4021), so I built this branch with fix(libkernel): restore Windows select build for Demons Souls testing #4021 merged: 907/909,guest_pthread_schedparam,guest_sched_priorityandguest_pthread_attrpass.agc_write_trackingandguest_kernel_stack_protectfail the same way onmainwith fix(libkernel): restore Windows select build for Demons Souls testing #4021 in this VM.Until #4077 is merged this branch also carries its commit; the change of this PR is the second commit.
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