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)
Mon, May 11, 9:41 AM
Unknown Object (File)
Thu, May 7, 1:59 PM
Unknown Object (File)
Thu, May 7, 12:18 PM
Unknown Object (File)
Sun, May 3, 7:02 PM
Unknown Object (File)
Mon, Apr 27, 3:54 PM
Unknown Object (File)
Thu, Apr 23, 12:23 AM
Unknown Object (File)
Tue, Apr 21, 1:33 PM
Unknown Object (File)
Tue, Apr 21, 5:18 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.