Repository navigation
fix(libkernel): return EINVAL from scePthreadCondattrSetclock and Destroy for a null attribute - #7029
Conversation
|
@milescoviello thanks, the review passed and this matches FreeBSD 11 libthr ( One question before we merge. On main, Do you have console evidence (a hardware trace or a homebrew test) that PS5's |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
…troy for a null attribute Both threw std::invalid_argument for a null or uninitialized attribute. FreeBSD's libthr returns EINVAL for one, as the other scePthread attribute calls here already do. The clock id is still stored as given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for checking. No, I don't have console evidence. The PR only cited FreeBSD 11's libthr, and I'd marked the PS5 side as unchecked. You're right that rejecting 5, 7, 11–15 could break a title that uses one of them and ignores the error, where it works today. I've dropped the clock check (62ac8d6, force-pushed as one commit). AI-assisted: yes (Claude Code) |
8ce4761 to
62ac8d6
Compare
|
Windows run in #7023 (comment) on the trimmed head 62ac8d6: guest_pthread_condattr 3/3, and clocks 0, 1, 2, 4, 5 and 12 are accepted, so the clock ids oneandonlydean asked about keep working. With the source reverted: "Condition attributes are not initialized". Written with Claude Code assistance (validation by a subagent, reviewed in this session). |
What
scePthreadCondattrSetclockandscePthreadCondattrDestroythrewstd::invalid_argumentfor a null or uninitialized attribute. FreeBSD 11's libthr_pthread_condattr_setclockand_pthread_condattr_destroyreturnEINVALfor one, as the otherscePthreadattribute calls here already do (scePthreadAttrDestroy,scePthreadAttrSetdetachstate, ...). Both now returnSCE_KERNEL_ERROR_EINVAL(0x80020016), whichpthread_condattr_setclockmaps toEINVAL.The clock id is still stored as given. libthr accepts only
CLOCK_REALTIME,CLOCK_VIRTUAL,CLOCK_PROFandCLOCK_MONOTONIC. But there's no console evidence for which ids PS5'sscePthreadCondattrSetclocktakes, andpthread_cond_timedwaithere serves the other idsclock_gettimesupports, so this PR leaves them working (see the review below).I don't know of a title that hits this. I found it while comparing the condition-variable attribute calls with libthr.
Tested
Ubuntu 24.04, GCC 13.3, Release, on
main6a32550.guest_pthread_condattr(new): a null or unset attribute gives0x80020016from both calls andEINVALfrompthread_condattr_setclock. Clocks 0, 1, 2, 4, 5 and 12 are accepted by both setclock calls. Destroying twice gives0x80020016the second time. Withmain'sCond.cppthe test aborts on the first call (the throw). With this change it passes 3 of 3.ctest -R '^guest_|libc': 403 of 403 pass, with this and one other small libkernel fix applied together.tools/check_conventions.pypasses.tools/pr_overlap.pyfinds no conflicting lines. It couldn't compare against Macos m4 #6222, fix(libc): append stream writes atomically on Windows #6287, fix(libkernel): refuse to detach or rejoin a thread that is being joined #6487 and fix(libkernel): reject port-zero connect on unconnected sockets #6884, which conflict withmainand touchCMakeLists.txt. The new test is registered away from the one fix(libkernel): keep a finished Windows thread's stack until it is joined or detached #4563 adds, andgit merge-treemerges this branch with fix(libkernel): keep a finished Windows thread's stack until it is joined or detached #4563 and fix(libkernel): report thread guard size from attribute queries #6893 cleanly.main's behaviour. (series run by @screamm)Not checked: macOS, a console.
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)🤖 Generated with Claude Code