Module Name:    src
Committed By:   maxv
Date:           Sat May  4 08:50:39 UTC 2019

Modified Files:
        src/sys/arch/amd64/amd64: copy.S
        src/sys/arch/i386/i386: copy.S

Log Message:
Hum. Fix a potentially catastrophic bug: kcopy() sets DF=1 if the areas
overlap, but doesn't clear it if the copy faults. If this happens, we
return to the caller with DF=1, and each future memory copy will be
backwards.

I wonder if there really are places where kcopy() is called with
overlapping areas.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/amd64/amd64/copy.S
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/i386/i386/copy.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/copy.S
diff -u src/sys/arch/amd64/amd64/copy.S:1.32 src/sys/arch/amd64/amd64/copy.S:1.33
--- src/sys/arch/amd64/amd64/copy.S:1.32	Sat Apr  6 20:25:26 2019
+++ src/sys/arch/amd64/amd64/copy.S	Sat May  4 08:50:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.32 2019/04/06 20:25:26 thorpej Exp $	*/
+/*	$NetBSD: copy.S,v 1.33 2019/05/04 08:50:39 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -242,6 +242,7 @@ ENTRY(copy_efault)
 END(copy_efault)
 
 ENTRY(kcopy_fault)
+	cld
 	ret
 END(kcopy_fault)
 

Index: src/sys/arch/i386/i386/copy.S
diff -u src/sys/arch/i386/i386/copy.S:1.30 src/sys/arch/i386/i386/copy.S:1.31
--- src/sys/arch/i386/i386/copy.S:1.30	Sat Apr  6 20:25:27 2019
+++ src/sys/arch/i386/i386/copy.S	Sat May  4 08:50:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.30 2019/04/06 20:25:27 thorpej Exp $	*/
+/*	$NetBSD: copy.S,v 1.31 2019/05/04 08:50:39 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2004, 2008 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.30 2019/04/06 20:25:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.31 2019/05/04 08:50:39 maxv Exp $");
 
 #include "assym.h"
 
@@ -309,6 +309,7 @@ END(copy_efault)
  */
 
 ENTRY(kcopy_fault)
+	cld
 	popl	%edi
 	popl	%esi
 	ret

Reply via email to