Skip to content

fix(libkernel): saturate overflowing high-resolution timers - #2064

Closed
STUPIDCONTEM wants to merge 1 commit into
boykopovar:mainfrom
STUPIDCONTEM:fix/hrtimer-overflow-results
Closed

STUPIDCONTEM wants to merge 1 commit into
boykopovar:mainfrom
STUPIDCONTEM:fix/hrtimer-overflow-results

Conversation

@STUPIDCONTEM

@STUPIDCONTEM STUPIDCONTEM commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Evidence review (2026-10-09)

Game/title evidence has not been established. Validation below is host regression/build evidence only; it does not establish title compatibility. Older checked items and test results describe their stated revisions, not current merge readiness.

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

What

Very large sceKernelAddHRTimerEvent durations can wrap during seconds-to-nanoseconds conversion and fire immediately. Check the conversion before multiplying or adding, saturating at the existing maximum deadline instead.

Tested

Windows 10 Pro 19045, WinLibs GCC 15.2.0 UCRT posix SEH r7, Release, BUILD_TESTING=ON. Independent branch from f145139676a48306681d3a4d5fabf83938759daf.

Extended the event-queue regression with multiplication and addition overflow boundaries, immediate and finite polling, a normal timer in the same queue, and cancellation. The extended test fails on the unchanged implementation and passes three repeated runs with this change. Default and libs builds passed; all 488 CTest tests passed (28.81 seconds); committed-head conventions and test-registration checks passed.

This preserves the existing deadline saturation policy; hardware behavior for centuries-long requests was not measured. No PS5 title was run. The original independent validation above was Windows-only. Checked open PRs for this timer conversion defect before submission.

Additional current-main integration verification: this fix is included in the 19 still-open proposals at 8f0190c793c6dfa2b7a3a3f33f3d2cbe2509937c, based on upstream d70b89989473ba1f6ae13e44e079e67f1f8a44b0. Declined proposals are excluded. Default and explicit libs builds passed on Windows; 513 tests passed and one was skipped (514 registered, 52.66 seconds). The affected event-queue test passed ten repetitions as part of a five-test interaction run.

Linux verification run 37928070910 at 338ec787cd5b78e7c4fa62d850af5c68c9395568 has the same production/test tree plus a fork-only workflow. With SPIRV-Tools and lavapipe enabled, default and guest-library builds passed; 496 distinct tests passed three repetitions each, 27 were skipped, and none failed (523 registered, 321.81 seconds). Two pre-existing graphics tests exceeded the 30-second target on their first run. This is combined integration evidence, not an independent exact-head build of this PR. The workflow's separate trusted conventions job passed for all 19 pinned PR heads and their live titles/descriptions. The current description also passes the same checker locally; the upstream rerun after refreshing the description remains behind GitHub's approval gate.

Checklist

  • Based on current main; no other open PR implements the same change (historical base; current readiness not asserted)
  • One topic per PR; follow-ups go in a new PR
  • No comments added to code
  • Unimplemented paths throw; no silent stubs added
  • No investigation notes, reports or images added to the repository
  • No third-party code added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes; the parent agent independently reviewed and tested the final change.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant