Re: [BUG?] sshd closes the connection after 2^16 bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> writes:

> Hmm, even funnier:
>
> (head -c 196480 /dev/zero; sleep 0.25; head -c 196480 /dev/zero) | ssh localhost "wc -c"
> 392960
> (head -c 196480 /dev/zero; sleep 0.2;  head -c 196480 /dev/zero) | ssh localhost "wc -c"
> 65536

Actually, just

(sleep 0.1;  head -c 196481 /dev/zero) | ssh localhost "wc -c"
65536
(sleep 0.2;  head -c 196481 /dev/zero) | ssh localhost "wc -c"
196481

And interestingly, if I do

echo 'sleep 1' > ~/.bashrc

then

(sleep 1.0;  head -c 196481 /dev/zero) | ssh localhost "wc -c"
65536
(sleep 1.1;  head -c 196481 /dev/zero) | ssh localhost "wc -c"
196481

Also,

ensibm:~>(head -c 196480 /dev/zero; sleep 1.2; echo boom) | ssh localhost "wc -c"
196485
ensibm:~>(head -c 196480 /dev/zero; sleep 1.0; echo boom) | ssh localhost "wc -c"
65536

and,

ensibm:~>rm ~/.bashrc
ensibm:~>(head -c 196480 /dev/zero; sleep 1.0; echo boom) | ssh localhost "sleep 1; wc -c"
65536
ensibm:~>(head -c 196480 /dev/zero; sleep 1.2; echo boom) | ssh localhost "sleep 1; wc -c"
196485

and more precisely,

ensibm:~>(head -c 196480 /dev/zero; sleep 1; echo boom) | ssh localhost "head -c 16383 | wc -c; sleep 2; wc -c"
16383
49153
ensibm:~>(head -c 196480 /dev/zero; sleep 1; echo boom) | ssh localhost "head -c 16384 | wc -c; sleep 2; wc -c"
16384
180101

The last one says that if strictly more than 196480 bytes are sent to
ssh, _and_ if strictly less than 16384 bytes (= 16KiB) are consumed
quickly, then the bug occurs.

--
Matthieu Moy
http://www-verimag.imag.fr/~moy/

[Index of Archives]     [Open SSH Unix Development]     [Fedora Users]     [Fedora Desktop]     [Yosemite Backpacking]     [KDE Users]     [Gnome Users]

  Powered by Linux