]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kevent: Fix an off-by-one in filt_timerexpire_l()
authorMark Johnston <markj@FreeBSD.org>
Wed, 25 May 2022 00:14:33 +0000 (20:14 -0400)
committerMark Johnston <markj@FreeBSD.org>
Mon, 25 Jul 2022 21:01:16 +0000 (17:01 -0400)
commitc48048ebdbed0901dacf1632af3b3db600533e64
tree25adb51451958b6c4863ee36e987e2adb7fa3518
parentdb8082886fd8cfbd8a3d533bb530ad392d0c4d85
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)
sys/kern/kern_event.c