Skip to content

fix(libkernel): reject unsupported condition clocks - #2116

Closed
STUPIDCONTEM wants to merge 1 commit into
boykopovar:mainfrom
STUPIDCONTEM:fix/condition-clock-validation
Closed

STUPIDCONTEM wants to merge 1 commit into
boykopovar:mainfrom
STUPIDCONTEM:fix/condition-clock-validation

Conversation

@STUPIDCONTEM

@STUPIDCONTEM STUPIDCONTEM commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Evidence review (2026-10-09)

Closed by maintainer; not ready to reopen. Required evidence: Title ID and a log showing a title supplies an unsupported condition clock; existing failure at wait is deliberate.

Game/title ID: none verified. No PS5 title execution is claimed.

What

Validate pthread_condattr_setclock before storing a clock ID. FreeBSD condition attributes accept IDs 0, 1, 2 and 4 (REALTIME, VIRTUAL, PROF and MONOTONIC); other values now return guest EINVAL without changing the attribute or guest errno. Previously every ID was stored, so a later timed wait could reach an unsupported clock path.

The accepted set comes directly from FreeBSD stable/11 _pthread_condattr_setclock. This is narrower than the set of clocks valid for clock_gettime: ID 5 is valid globally but unsupported for this attribute. The POSIX setter correction is distinct from #2089's clock-query errors and #2111's deadline arithmetic.

Tested

Windows 10 Pro 19045, WinLibs GCC 15.2 UCRT posix SEH r7, Release, BUILD_TESTING=ON, main 6cc0503.

  • The new registered guest_condattr_setclock test fails against unchanged upstream: invalid clock expected EINVAL 22, got success 0.
  • Five focused runs pass after the correction. Tests cover accepted IDs, rejected 3/5/-1/INT_MAX, unchanged guest errno, and null/destroyed attributes.
  • The test leaves MONOTONIC selected before rejected calls, creates a condition from that attribute without resetting its clock, then performs an expired monotonic timed wait. This exercises state preservation through the public API; no private fields or new getter exports are used.
  • With the separate build repair fix(build): declare SPIRV headers for Vulkan helper tests #2093, default and explicit libs builds passed; full CTest passed 495/495 in 32.68 seconds with no skips (stack a70fb1fd). Parent independently reviewed the implementation, contract and regression. Conventions, whitespace and test registration passed.

No Linux or title execution is claimed for this new correction.

Checklist

@github-actions github-actions Bot added libkernel build needs rebase Conflicts with main, rebase needed labels Oct 9, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing for the same reason as #2089: an unsupported clock already fails explicitly on main when a timed wait uses it, and no title is shown passing one. Reopen with the title ID and the log line if you find one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build libkernel needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants