Page MenuHomeFreeBSD

tcp: improve segment validation in SYN-RECEIVED
ClosedPublic

Authored by tuexen on Oct 2 2025, 7:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 13, 10:57 AM
Unknown Object (File)
Wed, Jun 10, 7:41 AM
Unknown Object (File)
Thu, Jun 4, 2:45 PM
Unknown Object (File)
Thu, Jun 4, 12:33 PM
Unknown Object (File)
Wed, Jun 3, 9:31 PM
Unknown Object (File)
Mon, Jun 1, 7:59 AM
Unknown Object (File)
May 14 2026, 8:03 AM
Unknown Object (File)
May 14 2026, 6:44 AM

Details

Summary

There validation of SEG.SEQ (first step in SEGMENT ARRIVES) should be done before the validation of SEG.ACK (fifth step in SEGMENT ARRIVES). Furthermore, when the SEG.SEQ validation fails, a challenge ACK should be sent instead of sending a RST-segment and moving the endpoint to CLOSED.

Thanks to Tilnel for reporting the issue on freebsd-net@.

Diff Detail

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

Event Timeline

tuexen requested review of this revision.Oct 2 2025, 7:59 AM
This revision is now accepted and ready to land.Oct 2 2025, 1:57 PM
jtl added inline comments.
sys/netinet/tcp_syncache.c
1284

This has a race condition in that it reads from sc after unlocking sch. IIUC, that means sc could have been freed by another thread by the time we run the log line. I think this same race is present on line 1209.

sys/netinet/tcp_syncache.c
1284

See D52868.