NetBSD Problem Report #36703

From jmmv@netbsd.org  Sun Jul 29 22:01:05 2007
Return-Path: <jmmv@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 748BF63B942
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 29 Jul 2007 22:01:05 +0000 (UTC)
Message-Id: <20070729220105.6B58063B130@mail.netbsd.org>
Date: Sun, 29 Jul 2007 22:01:05 +0000 (UTC)
From: jmmv@netbsd.org
Reply-To: jmmv@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: pccons can corrupt the screen
X-Send-Pr-Version: 3.95

>Number:         36703
>Category:       port-arc
>Synopsis:       pccons can corrupt the screen
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    tsutsui
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 29 22:05:00 +0000 2007
>Closed-Date:    Sat Sep 13 17:14:54 +0000 2008
>Last-Modified:  Sat Sep 13 17:15:03 +0000 2008
>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.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->port-arc-maintainer
Responsible-Changed-By: jmmv@netbsd.org
Responsible-Changed-When: Sun, 29 Jul 2007 22:07:39 +0000
Responsible-Changed-Why:
Filed incorrectly, sorry.  This belongs to port-arc.


Responsible-Changed-From-To: port-arc-maintainer->tsutsui
Responsible-Changed-By: tsutsui@NetBSD.org
Responsible-Changed-When: Sun, 14 Sep 2008 02:14:54 +0900
Responsible-Changed-Why:


State-Changed-From-To: open->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sun, 14 Sep 2008 02:14:54 +0900
State-Changed-Why:
Fixed and confirmed working.


From: Izumi Tsutsui <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/36703 CVS commit: src/sys/arch/arc/dev
Date: Sat, 13 Sep 2008 17:13:57 +0000 (UTC)

 Module Name:	src
 Committed By:	tsutsui
 Date:		Sat Sep 13 17:13:57 UTC 2008

 Modified Files:
 	src/sys/arch/arc/dev: pccons.c

 Log Message:
 - use memmove(9) for possible overlapped screen copies, per PR port-arc/36703
 - replace bcopy(9) with memcpy(9) where no overlap
 - fix a typo in comment
 Tested by using sysinst with pccons(4) on gxemul.


 To generate a diff of this commit:
 cvs rdiff -r1.55 -r1.56 src/sys/arch/arc/dev/pccons.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.