Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/i386 before resuming from failure during retur...



details:   https://anonhg.NetBSD.org/src/rev/f325df6bb161
branches:  trunk
changeset: 559177:f325df6bb161
user:      yamt <yamt%NetBSD.org@localhost>
date:      Thu Mar 11 11:42:04 2004 +0000

description:
before resuming from failure during return to user mode,
- clear PSL_NT.  it can be set by userland because setting it
  isn't a privileged operation.
  (cf. DSA-336-1, CVE-2002-0429)
- set PSL_I.  otherwise, if SIGSEGV is ignored, we'll
  end up to infinite loop, generating the same traps, with
  interrupts disabled.

diffstat:

 sys/arch/i386/i386/trap.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 72e8f806fc57 -r f325df6bb161 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Thu Mar 11 11:39:25 2004 +0000
+++ b/sys/arch/i386/i386/trap.c Thu Mar 11 11:42:04 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.198 2004/03/11 11:39:25 yamt Exp $  */
+/*     $NetBSD: trap.c,v 1.199 2004/03/11 11:42:04 yamt Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.198 2004/03/11 11:39:25 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.199 2004/03/11 11:42:04 yamt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -380,6 +380,17 @@
                        goto we_re_toast;
 
                frame->tf_eip = resume;
+
+               /*
+                * clear PSL_NT.  it can be set by userland because setting it
+                * isn't a privileged operation.
+                *
+                * set PSL_I.  otherwise, if SIGSEGV is ignored, we'll
+                * continue to generate traps infinitely with
+                * interrupts disabled.
+                */
+
+               frame->tf_eflags = (frame->tf_eflags & ~PSL_NT) | PSL_I;
                return;
 
        case T_PROTFLT|T_USER:          /* protection fault */



Home | Main Index | Thread Index | Old Index