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
F87832901: D35388.id106595.diff
Mon, Jul 8, 11:20 AM
F87826030: D35388.id106578.diff
Mon, Jul 8, 8:41 AM
Unknown Object (File)
Sat, Jul 6, 7:58 AM
Unknown Object (File)
Fri, Jul 5, 11:30 AM
Unknown Object (File)
Wed, Jun 19, 10:18 PM
Unknown Object (File)
May 20 2024, 2:11 PM
Unknown Object (File)
May 9 2024, 2:14 AM
Unknown Object (File)
May 9 2024, 2:14 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.