Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Hum. Fix a potentially catastrophic bug: kcopy() se...



details:   https://anonhg.NetBSD.org/src/rev/1aebfa97e6d6
branches:  trunk
changeset: 451031:1aebfa97e6d6
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat May 04 08:50:39 2019 +0000

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

diffstat:

 sys/arch/amd64/amd64/copy.S |  3 ++-
 sys/arch/i386/i386/copy.S   |  5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r 35de78515648 -r 1aebfa97e6d6 sys/arch/amd64/amd64/copy.S
--- a/sys/arch/amd64/amd64/copy.S       Sat May 04 08:30:06 2019 +0000
+++ b/sys/arch/amd64/amd64/copy.S       Sat May 04 08:50:39 2019 +0000
@@ -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 @@
 END(copy_efault)
 
 ENTRY(kcopy_fault)
+       cld
        ret
 END(kcopy_fault)
 
diff -r 35de78515648 -r 1aebfa97e6d6 sys/arch/i386/i386/copy.S
--- a/sys/arch/i386/i386/copy.S Sat May 04 08:30:06 2019 +0000
+++ b/sys/arch/i386/i386/copy.S Sat May 04 08:50:39 2019 +0000
@@ -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 @@
  */
 
 ENTRY(kcopy_fault)
+       cld
        popl    %edi
        popl    %esi
        ret



Home | Main Index | Thread Index | Old Index