NetBSD Problem Report #36512

From doshita@iij.ad.jp  Wed Jun 20 01:24:30 2007
Return-Path: <doshita@iij.ad.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 39C5863B882
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 20 Jun 2007 01:24:30 +0000 (UTC)
Message-Id: <200706200124.l5K1ORW4010067@rotr.iij.ad.jp>
Date: Wed, 20 Jun 2007 10:24:27 +0900 (JST)
From: Hiroki Doshita <doshita@iij.ad.jp>
Reply-To: doshita@iij.ad.jp
To: gnats-bugs@NetBSD.org
Subject: memmove doesn't fall back to memcpy
X-Send-Pr-Version: 3.95

>Number:         36512
>Category:       port-arm
>Synopsis:       memmove doesn't fall back to memcpy
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    scw
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 20 01:25:00 +0000 2007
>Closed-Date:    Sat Jun 23 09:16:46 +0000 2007
>Last-Modified:  Sat Jun 23 09:16:46 +0000 2007
>Originator:     Hiroki Doshita
>Release:        NetBSD 3.1
>Organization:
	Internet Initiative Japan, Inc.
>Environment:
Architecture: arm
Machine: armeb
>Description:
	the judgement of buffer overlap in xscale's memmove is wrong.

>How-To-Repeat:
>Fix:
Index: src/lib/libc/arch/arm/string/memmove.S
diff -u src/lib/libc/arch/arm/string/memmove.S:1.2 src/lib/libc/arch/arm/string/memmove.S:1.3
--- src/lib/libc/arch/arm/string/memmove.S:1.2	Mon Nov 17 15:25:34 2003
+++ src/lib/libc/arch/arm/string/memmove.S	Mon Jun 18 18:23:39 2007
@@ -53,10 +53,10 @@
 	/* Do the buffers overlap? */
 	cmp	r0, r1
 	moveq	pc, lr		/* Bail now if src/dst are the same */
-	subcc	r3, r0, r1	/* if (dst > src) r3 = dst - src */
-	subcs	r3, r1, r0	/* if (src > dsr) r3 = src - dst */
-	cmp	r3, r2		/* if (r3 < len) we have an overlap */
-	bcc	PIC_SYM(_C_LABEL(memcpy), PLT)
+	subhs	r3, r0, r1	/* if (dst > src) r3 = dst - src */
+	sublo	r3, r1, r0	/* if (src > dsr) r3 = src - dst */
+	cmp	r3, r2		/* if (r3 >= len) we have no overlap */
+	bhs	PIC_SYM(_C_LABEL(memcpy), PLT)

 	/* Determine copy direction */
 	cmp	r1, r0

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-arm-maintainer->scw
Responsible-Changed-By: scw@netbsd.org
Responsible-Changed-When: Wed, 20 Jun 2007 08:08:24 +0100
Responsible-Changed-Why:
I'll take this one.


From: Steve Woodford <scw@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36512 CVS commit: src/common/lib/libc/arch/arm/string
Date: Wed, 20 Jun 2007 22:31:21 +0000 (UTC)

 Module Name:	src
 Committed By:	scw
 Date:		Wed Jun 20 22:31:21 UTC 2007

 Modified Files:
 	src/common/lib/libc/arch/arm/string: memmove.S

 Log Message:
 Apply the patch supplied in PR/36512 to fix the buffer overlap check.


 To generate a diff of this commit:
 cvs rdiff -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/memmove.S

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

From: "Liam J. Foy" <liamjfoy@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36512 CVS commit: [netbsd-4] src/common/lib/libc/arch/arm/string
Date: Thu, 21 Jun 2007 14:25:01 +0000 (UTC)

 Module Name:	src
 Committed By:	liamjfoy
 Date:		Thu Jun 21 14:25:01 UTC 2007

 Modified Files:
 	src/common/lib/libc/arch/arm/string [netbsd-4]: memmove.S

 Log Message:
 Pull up following revision(s) (requested by scw in ticket #740):
 	common/lib/libc/arch/arm/string/memmove.S: revision 1.2
 Apply the patch supplied in PR/36512 to fix the buffer overlap check.


 To generate a diff of this commit:
 cvs rdiff -r1.1 -r1.1.6.1 src/common/lib/libc/arch/arm/string/memmove.S

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

From: "Liam J. Foy" <liamjfoy@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36512 CVS commit: [netbsd-3] src
Date: Fri, 22 Jun 2007 14:01:18 +0000 (UTC)

 Module Name:	src
 Committed By:	liamjfoy
 Date:		Fri Jun 22 14:01:18 UTC 2007

 Modified Files:
 	src/lib/libc/arch/arm/string [netbsd-3]: memmove.S
 	src/sys/lib/libkern/arch/arm [netbsd-3]: memmove.S

 Log Message:
 Pull up following revision(s) (requested by scw in ticket #1805):
 	common/lib/libc/arch/arm/string/memmove.S: revision 1.2
 Apply the patch supplied in PR/36512 to fix the buffer overlap check. The patch
 to memmove.S was provided via patch.


 To generate a diff of this commit:
 cvs rdiff -r1.5 -r1.5.2.1 src/lib/libc/arch/arm/string/memmove.S
 cvs rdiff -r1.4 -r1.4.2.1 src/sys/lib/libkern/arch/arm/memmove.S

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

State-Changed-From-To: open->closed
State-Changed-By: scw@netbsd.org
State-Changed-When: Sat, 23 Jun 2007 10:16:46 +0100
State-Changed-Why:
Fix applied, and pulled up into 3.x and 4.x release branches.
Thanks for the report!


>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.