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, Sep 22, 6:07 PM
Unknown Object (File)
Tue, Sep 22, 11:13 AM
Unknown Object (File)
Thu, Sep 10, 7:27 PM
Unknown Object (File)
Mon, Sep 7, 12:16 AM
Unknown Object (File)
Sun, Sep 6, 8:24 PM
Unknown Object (File)
Sun, Sep 6, 1:46 PM
Unknown Object (File)
Sun, Sep 6, 2:06 AM
Unknown Object (File)
Sat, Sep 5, 12: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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45700
Build 42588: arc lint + arc unit