Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/powerpc Make sure to do setenv/unsetenv in ...



details:   https://anonhg.NetBSD.org/src/rev/8454c38f8dee
branches:  trunk
changeset: 571333:8454c38f8dee
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Nov 18 21:09:37 2004 +0000

description:
Make sure to do setenv/unsetenv in pairs.  This prevents panics in
DIAGNOSTIC kernel when crossing segment boundaries.

diffstat:

 sys/arch/powerpc/powerpc/trap.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (86 lines):

diff -r 8d56c3ababaa -r 8454c38f8dee sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c   Thu Nov 18 15:34:23 2004 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c   Thu Nov 18 21:09:37 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.103 2004/08/16 10:16:16 aymeric Exp $       */
+/*     $NetBSD: trap.c,v 1.104 2004/11/18 21:09:37 matt Exp $  */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.103 2004/08/16 10:16:16 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.104 2004/11/18 21:09:37 matt Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -582,10 +582,10 @@
                uva += seglen;
                kp += seglen;
                len -= seglen;
+               unsetusr();
        }
 
   out:
-       unsetusr();
        curpcb->pcb_onfault = 0;
        return rv;
 }
@@ -610,10 +610,10 @@
                uva += seglen;
                kp += seglen;
                len -= seglen;
+               unsetusr();
        }
 
   out:
-       unsetusr();
        curpcb->pcb_onfault = 0;
        return rv;
 }
@@ -855,9 +855,12 @@
                len -= seglen;
                uva += seglen;
                for (; seglen-- > 0; p++) {
-                       if ((*kp++ = *(char *)p) == 0)
+                       if ((*kp++ = *(char *)p) == 0) {
+                               unsetusr();
                                goto out;
+                       }
                }
+               unsetusr();
        }
        rv = ENAMETOOLONG;
 
@@ -865,7 +868,6 @@
        if (done != NULL)
                *done = kp - (char *) kaddr;
  out2:
-       unsetusr();
        curpcb->pcb_onfault = 0;
        return rv;
 }
@@ -890,9 +892,12 @@
                len -= seglen;
                uva += seglen;
                for (; seglen-- > 0; p++) {
-                       if ((*(char *)p = *kp++) == 0)
+                       if ((*(char *)p = *kp++) == 0) {
+                               unsetusr();
                                goto out;
+                       }
                }
+               unsetusr();
        }
        rv = ENAMETOOLONG;
 
@@ -900,7 +905,6 @@
        if (done != NULL)
                *done = kp - (char *) kaddr;
  out2:
-       unsetusr();
        curpcb->pcb_onfault = 0;
        return rv;
 }



Home | Main Index | Thread Index | Old Index