Page MenuHomeFreeBSD

tcp: improve handling of stopped timers
ClosedPublic

Authored by tuexen on Jul 27 2026, 6:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Sep 2, 6:06 PM
Unknown Object (File)
Mon, Aug 31, 3:01 PM
Unknown Object (File)
Mon, Aug 31, 3:00 PM
Unknown Object (File)
Mon, Aug 31, 12:08 PM
Unknown Object (File)
Sun, Aug 30, 7:09 PM
Unknown Object (File)
Sun, Aug 30, 1:27 AM
Unknown Object (File)
Sat, Aug 29, 3:24 PM
Unknown Object (File)
Sat, Aug 29, 2:24 PM
Subscribers

Details

Summary

When a TCP timer is stopped, t_timers[] is set to SBT_MAX. Adding the corresponding t_precisions[] would result in overflows in tcp_timer_next(). To avoid this, skip stopped timers.

The problem was identified while debugging uperf by Lukas Book and an initial patch was provided by him. The problem can be observed by running netstat -nxptcp and looking for negative timer values.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/netinet/tcp_timer.c
860–861

Alternative patch. I'd prefer this one as it is less memory writes on timer stop. The cycle still needs to put the tp->t_timers[i] in the register anyway.

sys/netinet/tcp_timer.c
860–861

Makes sense. Will update the patch after testing it.

tuexen retitled this revision from tcp: improve stopping of timers to tcp: improve handling of stopped timers.Jul 27 2026, 11:06 PM
tuexen edited the summary of this revision. (Show Details)

Thanks and sorry for this bug :)

This revision was not accepted when it landed; it landed in state Needs Review.Jul 28 2026, 8:24 PM
This revision was automatically updated to reflect the committed changes.