[Bug 264131] 2nd and subsequent events on a repeating EVFILT_TIMER are delivered with twice the requested timer period

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 24 May 2022 18:00:09 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264131

Mark Johnston <markj@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Open
                 CC|                            |markj@FreeBSD.org

--- Comment #1 from Mark Johnston <markj@FreeBSD.org> ---
Thanks for the report and test program.  It looks like this is a regression
from commit 7cb40543e964.  This patch fixes the problem for me but needs more
thought:

diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 33607fe8c5f4..f1ee8de4e7ee 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -739,7 +739,7 @@ filt_timerexpire_l(struct knote *kn, bool proc_locked)
                if (delta == 0)
                        delta = 1;
                kn->kn_data += delta;
-               kc->next += (delta + 1) * kc->to;
+               kc->next += delta * kc->to;
                if (now >= kc->next)    /* overflow */
                        kc->next = now + kc->to;
                KNOTE_ACTIVATE(kn, 0);  /* XXX - handle locking */

-- 
You are receiving this mail because:
You are the assignee for the bug.