fix(libkernel): reject negative cond timedwait seconds #5566
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5566"
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 MarcZX10 on 2026-10-14T00:03:19Z.
What
Fixes #5561.
pthread_cond_timedwaitnow returnsEINVALwhen the absolute deadline has a negativetv_sec, matching FreeBSD and the existing validation of null deadlines and invalidtv_nsecvalues. Previously, a negative seconds value was treated as a deadline in the past and returnedETIMEDOUT(or reached the mutex ownership check first).The implementation commit is Hussein Kadhim's original commit, cherry-picked onto current
mainwith his author attribution preserved. A follow-up test by MarcZX100 checks the error precedence with both a held and an unowned mutex.#4953 edits the same test file and currently expects
{-1, 0}to returnETIMEDOUT; that expectation conflicts with this FreeBSD-compatible result and should becomeEINVAL. The production changes are otherwise independent (#4953validates condition-attribute clock IDs), soDepends on: none; whichever merges second needs a rebase and the shared test expectation updated.Tested
Linux, GCC 12.2, Ninja Release,
BUILD_TESTING=ON, currentmaind1670009fbfdfe57f8f26ee09ced77fe6b18c2ca:guest_cond_timedwait_tests,guest_cond_recursive_mutex_tests, andguest_cond_unowned_mutex_tests.guest_cond_timedwait,guest_cond_recursive_mutex, andguest_cond_unowned_mutexeach passed three consecutive CTest runs (9/9).tv_secguard restored to currentmain,guest_cond_timedwaitfailed as expected; with the fix restored, all three tests passed.tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main...HEADpassed.Checklist
main; no other open PR implements the same behaviorNotImplemented_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 github-actions[bot] on 2026-10-14T00:22:33Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/tests/GuestCondTimedwait.cppL19, L31, L106-108Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T01:08:07Z.
Closing: no title is known to reach this. With the queue at 750 open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed