Page MenuHomeFreeBSD

kevent(2): wrong EVFILT_TIMER timeouts when using NOTE_NSECONDS
ClosedPublic

Authored by gbe on Jan 9 2021, 5:42 PM.

Details

Summary

kevent(2): wrong EVFILT_TIMER timeouts when using NOTE_NSECONDS

From the PR: There is a typo in "timer2sbintime" (sys/kern/kern_event.c) when converting NOTE_NSECONDS to sbintime_t. For the nanosecond part US_TO_SBT instead of NS_TO_SBT is used. This results in weird timeout values.

PR: 252539
Submitted by: Jan Kokemüller <jan dot kokemueller at gmail dot com>

Test Plan

buildworld and a kyua test run

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gbe requested review of this revision.Jan 9 2021, 5:42 PM

We should also incorporate Jan's reproducer into the test suite, but I can do this after the fact.

Note that the "Submitted by" could be dropped if you recommit locally with git commit --author="Jan Kokemüller <jan.kokemueller@gmail.com>". I haven't seen any particular guidance one way or the other, but IMO the commit metadata attribution is more aesthetically pleasing.

This revision is now accepted and ready to land.Jan 9 2021, 5:47 PM

We should also incorporate Jan's reproducer into the test suite, but I can do this after the fact.

Note that the "Submitted by" could be dropped if you recommit locally with git commit --author="Jan Kokemüller <jan.kokemueller@gmail.com>". I haven't seen any particular guidance one way or the other, but IMO the commit metadata attribution is more aesthetically pleasing.

I'll do it once I commit the patch to main. Does your approval implies an "approved by: kevans"? ;-)

What could be done there, besides tests, is assert that e.g. converting SBT to NS (sbttons()) gives the original value. Or may be this is too naive, it should be orig value within some epsilon.