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)
Sat, Sep 27, 12:41 AM
Unknown Object (File)
Sep 8 2025, 4:52 AM
Unknown Object (File)
Aug 16 2025, 1:53 AM
Unknown Object (File)
Aug 14 2025, 4:54 PM
Unknown Object (File)
Aug 11 2025, 9:03 AM
Unknown Object (File)
Aug 11 2025, 6:16 AM
Unknown Object (File)
Aug 1 2025, 4:12 PM
Unknown Object (File)
Jul 6 2025, 10:57 PM
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