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)
Fri, Dec 6, 4:03 PM
Unknown Object (File)
Wed, Nov 27, 1:01 PM
Unknown Object (File)
Wed, Nov 27, 1:01 PM
Unknown Object (File)
Wed, Nov 27, 1:01 PM
Unknown Object (File)
Wed, Nov 27, 12:38 PM
Unknown Object (File)
Oct 10 2024, 8:33 AM
Unknown Object (File)
Oct 10 2024, 8:33 AM
Unknown Object (File)
Oct 10 2024, 8:33 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.