[PATCH net-2.6 0/3]: TCP fixes - Kernel

This is a discussion on [PATCH net-2.6 0/3]: TCP fixes - Kernel ; This fixes Bugzilla #10384
tcp_simple_retransmit does L increment without any checking
whatsoever for overflowing S+L when Reno is in use.
The simplest scenario I can currently think of is rather
complex in practice (there might be some more straightforward
cases ...

[PATCH net-2.6 2/3] [TCP]: tcp_simple_retransmit can cause S+L

This fixes Bugzilla #10384

tcp_simple_retransmit does L increment without any checking
whatsoever for overflowing S+L when Reno is in use.

The simplest scenario I can currently think of is rather
complex in practice (there might be some more straightforward
cases though). Ie., if mss is reduced during mtu probing, it
may end up marking everything lost and if some duplicate ACKs
arrived prior to that sacked_out will be non-zero as well,
leading to S+L > packets_out, tcp_clean_rtx_queue on the next
cumulative ACK or tcp_fastretrans_alert on the next duplicate
ACK will fix the S counter.

More straightforward (but questionable) solution would be to
just call tcp_reset_reno_sack() in tcp_simple_retransmit but
it would negatively impact the probe's retransmission, ie.,
the retransmissions would not occur if some duplicate ACKs
had arrived.

So I had to add reno sacked_out reseting to CA_Loss state
when the first cumulative ACK arrives (this stale sacked_out
might actually be the explanation for the reports of left_out
overflows in kernel prior to 2.6.23 and S+L overflow reports
of 2.6.24). However, this alone won't be enough to fix kernel
before 2.6.24 because it is building on top of the commit
1b6d427bb7e ([TCP]: Reduce sacked_out with reno when purging
write_queue) to keep the sacked_out from overflowing.

[PATCH net-2.6 0/3]: TCP fixes

Hi Dave,

Here are some TCP fixes that resulted from the last weeks reports
& debug. The first one is quite likely to hit but it's considerably
harder to get it print an overflow warning, while I've seen two
reports about the second one (one of them is for 2.6.24.y), please
ignore the earlier version of the tcp_simple_retransmit patch. The
FRTO patch is once again result of code review rather than some
report but seems necessary to avoid detection of some not that
likely cases as spurious RTOs when there were some other losses
in the same window with the probe. Nevertheless, it should be safe
to return non-FRTO behavior.

....So far, they're just compile tested. I'll see if I find some time
to boot them on the evening.

There might still be one fackets_out miscounter awaiting detection
with debug patch (I hope Georgi catches it) because none of these
seem an obvious reason for triggery of the !sacked_out && fackets_out
trap.

All of them are also valid for stables but please note that it won't
be too easy, at least for the first & second patch, because of recent
changes (especially if stable != 2.6.24.y). I'll try to do the
adapted versions later on for the stable.

Fixes a long-standing bug which makes NewReno recovery crippled.
With GSO the whole head skb was marked as LOST which is in
violation of NewReno procedure that only wants to mark one packet
and ended up breaking our TCP code by causing counter overflow
because our code was built on top of assumption about valid
NewReno procedure. This manifested as triggering a WARN_ON for
the overflow in a number of places.

It seems relatively safe alternative to just do nothing if
tcp_fragment fails due to oom because another duplicate ACK is
likely to be received soon and the fragmentation will be retried.

Special thanks goes to Soeren Sonnenburg who was
lucky enough to be able to reproduce this so that the warning
for the overflow was hit. It's not as easy task as it seems even
if this bug happens quite often because the amount of outstanding
data is pretty significant for the mismarkings to lead to an
overflow.

Because it's very late in 2.6.25-rc cycle (if this even makes in
time), I didn't want to touch anything with SACK enabled here.
Fragmenting might be useful for it as well but it's more or less
a policy decision rather than mandatory fix. Thus there's no need
to rush and we can postpone considering tcp_fragment with SACK
for 2.6.26.

In 2.6.24 and earlier, this very same bug existed but the effect
is slightly different because of a small changes in the if
conditions that fit to the patch's context. With them nothing
got lost marker and thus no retransmissions happened.