2002-07-28 21:01:25

by Chen, Kenneth W

[permalink] [raw]
Subject: text screen corruption - bug in console vga code

We have observed text mode console screen corruption on some architecture.
The symptom was on a text console, when edit a large file with vi, pressing
"down" arrow key to scroll would cause the corruption.

It turns out that the culprit was the kernel console vga code where scrup()
is illegally using mempcy() function when src/dest memory areas overlaps.
This bug showed up when we optimized memcpy to use advanced optimization
technique.

This patch make use of memmove() which handles overlapping areas gracefully.
Would the maintainer please push this into the base?


--- drivers/char/console.c.orig Wed Jul 24 14:47:20 2002
+++ drivers/char/console.c Wed Jul 24 14:47:55 2002
@@ -259,7 +259,7 @@
return;
d = (unsigned short *) (origin+video_size_row*t);
s = (unsigned short *) (origin+video_size_row*(t+nr));
- scr_memcpyw(d, s, (b-t-nr) * video_size_row);
+ scr_memmovew(d, s, (b-t-nr) * video_size_row);
scr_memsetw(d + (b-t-nr) * video_num_columns, video_erase_char,
video_size_row*nr);
}


2002-07-29 19:36:09

by James Simmons

[permalink] [raw]
Subject: Re: text screen corruption - bug in console vga code


> We have observed text mode console screen corruption on some architecture.
> The symptom was on a text console, when edit a large file with vi, pressing
> "down" arrow key to scroll would cause the corruption.
>
> It turns out that the culprit was the kernel console vga code where scrup()
> is illegally using mempcy() function when src/dest memory areas overlaps.
> This bug showed up when we optimized memcpy to use advanced optimization
> technique.
>
> This patch make use of memmove() which handles overlapping areas gracefully.
> Would the maintainer please push this into the base?

Done :-) Will be in th enext sync up.