Page MenuHomeFreeBSD

filt_timerexpire: do not iterate over the interval
ClosedPublic

Authored by kib on May 1 2021, 3:08 PM.

Details

Summary

User-supplied data might make this loop too time-consuming. Divide directly, and handle both the possibility that we were woken up earlier, and arithmetic overflows/underflows from the calculation.

Reported by: pho

Diff Detail

Repository
rG 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

kib requested review of this revision.May 1 2021, 3:08 PM
kib created this revision.
sys/kern/kern_event.c
741

This case represents the timer firing early - why do we adjust anything here?

kib marked an inline comment as done.May 3 2021, 3:37 PM
kib added inline comments.
sys/kern/kern_event.c
741

Because it is activating knote, which was done before too.

This revision is now accepted and ready to land.May 3 2021, 3:59 PM
kib marked an inline comment as done.

Skip activation for the case now <= kc_next, and do not increment data.

This revision now requires review to proceed.May 3 2021, 4:03 PM
This revision is now accepted and ready to land.May 3 2021, 4:16 PM