Page MenuHomeFreeBSD

tcp: improve segment validation in SYN-RECEIVED
ClosedPublic

Authored by tuexen on Oct 2 2025, 7:59 AM.
Tags
None
Referenced Files
F150536489: D52849.id163344.diff
Thu, Apr 2, 3:51 AM
Unknown Object (File)
Sat, Mar 21, 8:39 PM
Unknown Object (File)
Wed, Mar 18, 10:47 AM
Unknown Object (File)
Sun, Mar 15, 10:23 AM
Unknown Object (File)
Tue, Mar 3, 7:45 AM
Unknown Object (File)
Feb 23 2026, 9:54 PM
Unknown Object (File)
Feb 23 2026, 9:54 PM
Unknown Object (File)
Feb 23 2026, 9:54 PM

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.