Subject: kern/36703: pccons can corrupt the screen
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <jmmv@netbsd.org>
List: netbsd-bugs
Date: 07/29/2007 22:05:00
>Number:         36703
>Category:       kern
>Synopsis:       pccons can corrupt the screen
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 29 22:05:00 +0000 2007
>Originator:     Julio M. Merino Vidal
>Release:        NetBSD 4.99.25
>Organization:
Julio M. Merino Vidal <jmmv@NetBSD.org>
>Environment:
	Not relevant.  Reporting based on code inspection.
>Description:
	The pccons driver in NetBSD/arc uses bcopy to implement some movement
	of screen contents.  This is incorrect because in some cases the source
	and target regions may overlap, resulting in screen corruption.

	I observed this same behavior in NetBSD/shark.  During sysinst the
	screen was corrupted: duplicates of messages appeared where the screen
	was supposed to be blank instead.  I expect the same thing to happen
	in arc, but I cannot check since I do not have the appropriate
	hardware.

	For more details see:

	http://mail-index.netbsd.org/tech-install/2007/07/29/0000.html
	http://mail-index.netbsd.org/source-changes/2007/07/29/0041.html
>How-To-Repeat:
	A possibility: use sysinst.  When reaching the sets selection menu,
	choose "Full distribution" and the screen should be corrupted at
	that point, assuming that the following menu is the one that lets
	you decide if you want to change the disklabel or not.  (Otherwise
	curses may decide to use another algorithm to refresh the screen and
	not show the problem.)
>Fix:
	The fix involves replacing the calls to bcopy by calls to memmove,
	which is safe to regions that overlap.  However, the pccons in arc
	provides its own wcopy function (a bcopy which works on words
	instead of bytes) which is used in some situations.  Fixing this one
	requires a rewrite of the function and I don't dare to do it without
	being able to test the results.  Hence why I'm filing this report.