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)
Sat, Jan 18, 6:27 AM
Unknown Object (File)
Mon, Jan 6, 9:12 PM
Unknown Object (File)
Fri, Dec 27, 2:25 PM
Unknown Object (File)
Dec 6 2024, 4:03 PM
Unknown Object (File)
Nov 27 2024, 1:01 PM
Unknown Object (File)
Nov 27 2024, 1:01 PM
Unknown Object (File)
Nov 27 2024, 1:01 PM
Unknown Object (File)
Nov 27 2024, 12:38 PM

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.