Re: Pty is losing bytes

Theodore Ts'o
2005-02-18T16:33:09Z

On Thu, Feb 17, 2005 at 07:45:56AM -0800, Linus Torvalds wrote:
>
>
> On Wed, 16 Feb 2005, Theodore Ts'o wrote:
> >
> > Yes, but then when the buffer is full, and we return the "we'll take
> > anything" return value, the code that was getting confused with the
> > "incorrect" receive_room value will still be getting confused....
>
> But that's fine - at that point we're literally _supposed_ to drop
> characters: we have to, in order to see the EOLN.
>
> But we're only supposed to drop characters IFF:
> - the buffer is full
> - we are in canon mode
> - we _still_ haven't seen a single EOLN in the whole buffer

Sure, but in that case, if we return "no worries, we have plenty of
memory", then we're opening ourselves up to the memory overrun problem
that was the original issue in the first place. I suspect that the
underlying problem is that somewhere in the tty layer there is code
that is using receive_room() as permission to simply push that many
characters into the receive queue, instead of using that function as
an hint of how many characters would be profitable to feed into the
line discpline.

- Ted