Page MenuHomeFreeBSD

tcp: Correctly compute the retransmit length for all 64-bit platforms.
ClosedPublic

Authored by hselasky on Jun 2 2022, 6:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 16, 1:40 AM
Unknown Object (File)
Wed, Mar 12, 5:03 PM
Unknown Object (File)
Mar 6 2025, 8:13 AM
Unknown Object (File)
Feb 20 2025, 2:42 AM
Unknown Object (File)
Jan 31 2025, 2:02 AM
Unknown Object (File)
Jan 27 2025, 3:13 PM
Unknown Object (File)
Jan 27 2025, 2:28 PM
Unknown Object (File)
Jan 27 2025, 12:42 AM

Details

Summary
When the TCP sequence number subtracted is greater than 2**32 minus
the limit, or 2**31 minus the limit, the use of unsigned long as an
intermediate variable, may result in an incorrect retransmit length
computation on all 64-bit platforms in the TCP stack.

While at it create a helper macro to facilitate the computation of
the difference between TCP sequence numbers.

MFC after:      3 days
Sponsored by:   NVIDIA Networking

Diff Detail

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

Event Timeline

How to reproduce:

cc -DSIMULATE_32BIT_LONG test7.c && ./a.out > a.txt

cc test7.c && ./a.out > b.txt

diff -u a.txt b.txt
hselasky edited the summary of this revision. (Show Details)
rscheff added a subscriber: rscheff.

There may be other places where tcp seq numbers are calculated using simple substraction...

This revision is now accepted and ready to land.Jun 2 2022, 6:44 PM

There may be other places where tcp seq numbers are calculated using simple substraction...

I'll have a look. Could you check the sequence number in the dump's you've got, if they match this criteria?

There may be other places where tcp seq numbers are calculated using simple substraction...

I did a grep for unsigned long and u_long and this was the only place I could see was affected.