All of lore.kernel.org
 help / color / mirror / Atom feed
* buffer overflows in the tty flip buffer in 2.6.17
@ 2007-02-17 12:29 Mockern
  2007-02-17 13:14 ` Jiri Slaby
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mockern @ 2007-02-17 12:29 UTC (permalink / raw)
  To: linux-kernel

When data is received from the hardware, it needs to be placed into the tty device's flip buffer. This can be done with the following bit of code:

for (i = 0; i < data_size; ++i) {
        if (tty->flip.count >= TTY_FLIPBUF_SIZE)
                tty_flip_buffer_push(tty);
        tty_insert_flip_char(tty, data[i], 0);
}
tty_flip_buffer_push(tty);

This example makes sure there are no buffer overflows in the tty flip buffer as the data is being added. 

But how it is done in 2.6.17 linux kernel? I did check this "overflow code" in new tty driver's code. This code looks like just removed. But somehow overflow in the tty buffer must be kept.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: buffer overflows in the tty flip buffer in 2.6.17
  2007-02-17 12:29 buffer overflows in the tty flip buffer in 2.6.17 Mockern
@ 2007-02-17 13:14 ` Jiri Slaby
  2007-02-17 15:17 ` Lennart Sorensen
  2007-02-19 20:19 ` Alan
  2 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2007-02-17 13:14 UTC (permalink / raw)
  To: Mockern; +Cc: linux-kernel

Mockern napsal(a):
> When data is received from the hardware, it needs to be placed into the tty device's flip buffer. This can be done with the following bit of code:
> 

> for (i = 0; i < data_size; ++i) {
>         if (tty->flip.count >= TTY_FLIPBUF_SIZE)
>                 tty_flip_buffer_push(tty);
>         tty_insert_flip_char(tty, data[i], 0);
> }
> tty_flip_buffer_push(tty);

size = tty_buffer_request_room(tty, data_size);
tty_insert_flip_string(tty, data, min(data_size, size));
tty_flip_buffer_push(tty);
+ cope with size < data_size (some data_size -= size with 3 lines above in do {} 
while (data_size))

regards,
-- 
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E

Hnus <hnus@fi.muni.cz> is an alias for /dev/null

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: buffer overflows in the tty flip buffer in 2.6.17
  2007-02-17 12:29 buffer overflows in the tty flip buffer in 2.6.17 Mockern
  2007-02-17 13:14 ` Jiri Slaby
@ 2007-02-17 15:17 ` Lennart Sorensen
  2007-02-17 15:52   ` Mockern
  2007-02-19 20:19 ` Alan
  2 siblings, 1 reply; 6+ messages in thread
From: Lennart Sorensen @ 2007-02-17 15:17 UTC (permalink / raw)
  To: Mockern; +Cc: linux-kernel

On Sat, Feb 17, 2007 at 03:29:31PM +0300, Mockern wrote:
> When data is received from the hardware, it needs to be placed into the tty device's flip buffer. This can be done with the following bit of code:
> 
> for (i = 0; i < data_size; ++i) {
>         if (tty->flip.count >= TTY_FLIPBUF_SIZE)
>                 tty_flip_buffer_push(tty);
>         tty_insert_flip_char(tty, data[i], 0);
> }
> tty_flip_buffer_push(tty);
> 
> This example makes sure there are no buffer overflows in the tty flip buffer as the data is being added. 
> 
> But how it is done in 2.6.17 linux kernel? I did check this "overflow code" in new tty driver's code. This code looks like just removed. But somehow overflow in the tty buffer must be kept.

Well there was a problem in 2.6.16, which was fixed by 2.6.18, although
I am not sure if it was done by 2.6.17.  It would loose characters due
to buffer overflow and not properly checking under high load.  I grabbed
a few patches from the git tree that were added after 2.6.16 to fix the
tty problems I was having.

--
Len Sorensen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: buffer overflows in the tty flip buffer in 2.6.17
  2007-02-17 15:17 ` Lennart Sorensen
@ 2007-02-17 15:52   ` Mockern
  2007-02-17 16:10     ` Lennart Sorensen
  0 siblings, 1 reply; 6+ messages in thread
From: Mockern @ 2007-02-17 15:52 UTC (permalink / raw)
  To: lsorense; +Cc: linux-kernel

Thanx for your respond. 

Could you please inform me what patches exactly you have grabbed?

>On Sat, Feb 17, 2007 at 03:29:31PM +0300, Mockern wrote:
>> When data is received from the hardware, it needs to be placed into the tty device's flip buffer. This can be done with the following bit of code:
>> 
>> for (i = 0; i < data_size; ++i) {
>>         if (tty->flip.count >= TTY_FLIPBUF_SIZE)
>>                 tty_flip_buffer_push(tty);
>>         tty_insert_flip_char(tty, data[i], 0);
>> }
>> tty_flip_buffer_push(tty);
>> 
>> This example makes sure there are no buffer overflows in the tty flip buffer as the data is being added. 
>> 
>> But how it is done in 2.6.17 linux kernel? I did check this "overflow code" in new tty driver's code. This code looks like just removed. But somehow overflow in the tty buffer must be kept.
>
>Well there was a problem in 2.6.16, which was fixed by 2.6.18, although
>I am not sure if it was done by 2.6.17.  It would loose characters due
>to buffer overflow and not properly checking under high load.  I grabbed
>a few patches from the git tree that were added after 2.6.16 to fix the
>tty problems I was having.
>
>--
>Len Sorensen
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/


-- 
Сегодня удачный день, чтобы завести почту на Яндексе http://mail.yandex.ru

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: buffer overflows in the tty flip buffer in 2.6.17
  2007-02-17 15:52   ` Mockern
@ 2007-02-17 16:10     ` Lennart Sorensen
  0 siblings, 0 replies; 6+ messages in thread
From: Lennart Sorensen @ 2007-02-17 16:10 UTC (permalink / raw)
  To: Mockern; +Cc: linux-kernel

On Sat, Feb 17, 2007 at 06:52:03PM +0300, Mockern wrote:
> Thanx for your respond. 
> 
> Could you please inform me what patches exactly you have grabbed?

If you see the thread "Re: Strange problem with tty layer", which I just
posted a final update too, it has the list of linux-2.6 git commits that
I applied to 2.6.16 in order (some of them are probably in 2.6.17
already, while others might not be).

--
Len Sorensen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: buffer overflows in the tty flip buffer in 2.6.17
  2007-02-17 12:29 buffer overflows in the tty flip buffer in 2.6.17 Mockern
  2007-02-17 13:14 ` Jiri Slaby
  2007-02-17 15:17 ` Lennart Sorensen
@ 2007-02-19 20:19 ` Alan
  2 siblings, 0 replies; 6+ messages in thread
From: Alan @ 2007-02-19 20:19 UTC (permalink / raw)
  To: Mockern; +Cc: linux-kernel

> But how it is done in 2.6.17 linux kernel? I did check this "overflow code" in new tty driver's code. This code looks like just removed. But somehow overflow in the tty buffer must be kept.

The new tty layer manages memory allocation dynamically and handles
overflows itself. Just throw data at it and the right thing will occur in
current kernels.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-02-19 19:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-17 12:29 buffer overflows in the tty flip buffer in 2.6.17 Mockern
2007-02-17 13:14 ` Jiri Slaby
2007-02-17 15:17 ` Lennart Sorensen
2007-02-17 15:52   ` Mockern
2007-02-17 16:10     ` Lennart Sorensen
2007-02-19 20:19 ` Alan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.