Page MenuHomeFreeBSD

tcp: use locked callouts for the TCP timers
AbandonedPublic

Authored by glebius on Nov 4 2022, 3:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 6:30 AM
Unknown Object (File)
Sat, Nov 23, 12:55 PM
Unknown Object (File)
Thu, Nov 7, 6:21 PM
Unknown Object (File)
Thu, Nov 7, 9:03 AM
Unknown Object (File)
Sep 27 2024, 5:10 AM
Unknown Object (File)
Sep 25 2024, 12:32 PM
Unknown Object (File)
Sep 24 2024, 1:30 AM
Unknown Object (File)
Sep 22 2024, 5:46 PM
Subscribers

Details

Reviewers
hselasky
Group Reviewers
transport
Summary

Initialize the TCP timers pointing at the inpcb rwlock as the callout
lock. This allows the tcp_timer_stop() to stop a timer immediately
and avoid use of callout_async_drain(). In its turn this makes
tcp_discardcb() the single entry point for tcpcb destructor, merging
the tcp_freecb() to the end of the function. This also removed lots
of lingering checks in the callout handlers themselves.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 48139
Build 45026: arc lint + arc unit

Event Timeline

Note: this version will fire KASSERT at certain conditions, as it is incorrect. However, even with correct assert this version has potential use after free, that is hidden by the use of SMR memory for tcpcbs. Right now this revision is not targeted to cgit, it is posted just to share code.

sys/netinet/tcp_timer.c
1145

You cannot remove the callout_async_drain() it needs to stay, because the mutex may be used after free!

Try to keep this call and the issue with SMR will go away!

Yes, you are right. It is impossible to create raceless self-freeing callout with two callouts embedded into the same structure. This revision superseded by D37321.