HomeFreeBSD

kevent: Fix an off-by-one in filt_timerexpire_l()

Description

kevent: Fix an off-by-one in filt_timerexpire_l()

Suppose a periodic kevent timer fires close to its deadline, so that
now - kc->next is small. Then delta ends up being 1, and the next timer
deadline is set to (delta + 1) * kc->to, where kc->to is the timer
period. This means that the timer fires at half of the requested rate,
and the value returned in kn_data is similarly inaccurate.

Approved by: so
Security: FreeBSD-EN-22:16.kqueue
PR: 264131
Fixes: 7cb40543e964 ("filt_timerexpire: do not iterate over the interval")
Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 524dadf7a8725dea144571843e611dbdbd59d668)
(cherry picked from commit 129112f80d2bfe6091ebb8656912fb55d6192e1f)

Details

Provenance
markjAuthored on May 25 2022, 12:14 AM
Parents
rGdb8082886fd8: CAM: Keep periph_links when restoring CCB in camperiphdone().
Branches
Unknown
Tags
Unknown