fix(libkernel): accept EVFILT_TIMER re-adds with a time unit or on a disabled timer as measured on a PS5 #11236
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11236"
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 orezraey on 2026-10-25T22:26:27Z.
What
Re-adding an existing
EVFILT_TIMERwithEV_ADDnow works in two cases that used to throw, as a retail PS5 (firmware 13.60) handles them:fflagscarry a time unit (NOTE_SECONDS,NOTE_MSECONDS,NOTE_USECONDSorNOTE_NSECONDS);Measured with a homebrew probe from a payload process; the source and console log are in this gist (
ptimer2).On the console:
fflags. A 30 ms timer re-added withNOTE_MSECONDSand 30 fired at 30, 60 and 90 ms. Re-added withNOTE_NSECONDS, it fired first at its armed expiry and then at the new period. That is the rule AnyPS5 already follows for re-adds withfflags0: keep the armed expiry, apply the new period after it. So the re-add path now accepts any single unit with a positive period. A combination of units or any otherfflagsbit still throws.EV_DISABLE, re-adding withEV_ADDand 30 or 60 ms returned 0, and nothing fired within 400 ms: the timer stays disabled. It now takes the new period andudataand stays disabled.EV_ONESHOTtimer re-added (one fire),data0 on a new timer (fires at once),data-1 (EV_ERRORwith 22),EV_CLEARandEV_DISPATCH.data0 (EV_ADD, orEV_DISABLE/EV_ENABLE) zeroes the period on the console, as FreeBSD'skqueue_registercopiesdataonto the note. The timer then fires about every millisecond with 10 to 13 expiries each, and an enable after 120 ms disabled reported about 912. AnyPS5 keeps the period there. That gap leads the debt entry. Reproducing it would mean modelling the console's callout granularity.Before and after
EV_ADDon an existingEVFILT_TIMERfflagsfflagsbitsdata0Tested
Windows 11, WinLibs GCC 15.2, full build. The seven tests matching
kqueue|equeue|kevent|timerpass 3 times out of 3.guest_kqueue'sTimerReaddnow checks:NOTE_MSECONDSreturns 0 and fires no earlier than the armed expiry;NOTE_MSECONDS|NOTE_USECONDSandfflags0x10 still throw;tools/check_conventions.pypasses. Head4c9e31f18conmaineeb7760717(thesem_timedwaitdebt line now comes frommain, as merged by #10105). On WSL Ubuntu with GCC 13, the six of them registered on Linux (guest_kqueue,guest_equeue_events,guest_itimer,guest_itimer_pending_default,guest_getitimer,guest_kernel_sys_ktimer) pass 3 times out of 3 at the same head.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)keventone; merge order only); #11862 (ionut27001) rewrites thesetrlimitdebt entry next to theEVFILT_TIMERone (merge order only)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:30:16Z.
Review: APPROVED
Reviewed exact head
c7392b3fca6fb3dc36d3d53c1ff78016e4b576dc. The cited firmware 13.60 probe log records successful re-adds withNOTE_MSECONDS/NOTE_NSECONDS, preservation of the original armed expiry, and disabled re-adds producing no events; the code keeps that expiry, updates the interval andudata, and leaves disabled timers disabled. The regression covers a millisecond re-add, rejected combined/unknown units and disabled behavior. Current-main conventions andgit diff --checkpass; conventions reports only pre-existing debt-length warnings. Hosted product jobs were skipped by path policy; the author reports the focused Windows timer tests, which I did not rerun locally. The three declared debt-file merge-order PRs remain open.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T23:51:10Z.
Review: CHANGES_REQUESTED
Rechecked exact head
c7392b3fca6fb3dc36d3d53c1ff78016e4b576dc. I still have no code finding in the timer implementation. A new overlap report identifies open #11267, and I verified the exact current heads (c7392b3...and118f0b8...) withgit merge-tree --write-tree; they conflict indocs/dev/debt/libkernel.md.CONTRIBUTING.mdrequires the agreed order and actual prerequisite on the checklist. Please coordinate with #11267’s author and add it toDepends onif it must land first, then rebase/resolve and rerun the focused timer tests. Existing hosted policy checks pass; product jobs are skipped, and the Windows focused tests are author-reported.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T05:41:06Z.
Review: DISMISSED
The
Depends on: #11267checklist correction and the added repeated Windows/Linux timer runs resolve my earlier merge-order request; I found no code issue in the unchanged implementation. Currentmainhas since advanced: this branch is 1 ahead /242 behind14c99b52ac, with merge preview clean, and #11267 remains open. After the stated merge order, please refresh onto current main and rerun the focused timer tests on the resulting exact head. This request is only for the required current-head validation.