Page MenuHomeFreeBSD

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

Authored by markj on May 24 2022, 10:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 1:29 PM
Unknown Object (File)
Jan 26 2024, 8:24 PM
Unknown Object (File)
Jan 14 2024, 8:59 AM
Unknown Object (File)
Jan 13 2024, 5:53 PM
Unknown Object (File)
Dec 23 2023, 12:10 AM
Unknown Object (File)
Dec 22 2023, 1:39 AM
Unknown Object (File)
Dec 16 2023, 7:30 AM
Unknown Object (File)
Nov 23 2023, 7:21 AM
Subscribers

Details

Summary

Suppose a periodic kevent timer fires close to its deadline, so 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, because the computation of delta rounds down, it seems that the
kn_data value is incorrect as well.

PR: 264131
Fixes: 7cb40543e964 ("filt_timerexpire: do not iterate over the interval")

Test Plan

I have some updates to the libkqueue regression test which detect this bug.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable