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 fix confused CS selector, fixes the panic...



details:   https://anonhg.NetBSD.org/src/rev/c1b4e17b3e7c
branches:  trunk
changeset: 752097:c1b4e17b3e7c
user:      drochner <drochner%NetBSD.org@localhost>
date:      Sun Feb 14 11:09:54 2010 +0000

description:
fix confused CS selector, fixes the panic reported by Mark Davis
per PR port-i386/42787 (the panic happens due to a GPF when a
privileged descriptor is tried to be loaded with the UPL bit set)
The original bug is very old (pre-2.0, i386/svr4_machdep.c rev. 1.69),
but it was relatively harmless until the order of GDT entries was
shuffled (pre-5.0, i386/segments.h rev. 1.42). Before, it caused
a userlevel data selector to be used for CS which broke the emulation
(likely the reason of PR port-i386/32424). The shuffle made that
a privileged selector was used, causing the GPF.
(recent -current doesn't panic on that GPF which seems to be a
side effect of another change)

diffstat:

 sys/arch/i386/i386/ibcs2_machdep.c |  6 +++---
 sys/arch/i386/i386/svr4_machdep.c  |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 23728461c462 -r c1b4e17b3e7c sys/arch/i386/i386/ibcs2_machdep.c
--- a/sys/arch/i386/i386/ibcs2_machdep.c        Sat Feb 13 23:38:17 2010 +0000
+++ b/sys/arch/i386/i386/ibcs2_machdep.c        Sun Feb 14 11:09:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_machdep.c,v 1.39 2009/12/10 14:13:50 matt Exp $  */
+/*     $NetBSD: ibcs2_machdep.c,v 1.40 2010/02/14 11:09:54 drochner Exp $      */
 
 /*-
  * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.39 2009/12/10 14:13:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.40 2010/02/14 11:09:54 drochner Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -74,7 +74,7 @@
                pcb->pcb_savefpu.sv_87.sv_env.en_cw = __iBCS2_NPXCW__;
        tf = l->l_md.md_regs;
        tf->tf_eax = 0x2000000;         /* XXX base of heap */
-       tf->tf_cs = GSEL(LUCODEBIG_SEL, SEL_UPL);
+       tf->tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL);
 }
 
 /*
diff -r 23728461c462 -r c1b4e17b3e7c sys/arch/i386/i386/svr4_machdep.c
--- a/sys/arch/i386/i386/svr4_machdep.c Sat Feb 13 23:38:17 2010 +0000
+++ b/sys/arch/i386/i386/svr4_machdep.c Sun Feb 14 11:09:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svr4_machdep.c,v 1.95 2009/12/10 14:13:50 matt Exp $    */
+/*     $NetBSD: svr4_machdep.c,v 1.96 2010/02/14 11:09:54 drochner Exp $        */
 
 /*-
  * Copyright (c) 1994, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.95 2009/12/10 14:13:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.96 2010/02/14 11:09:54 drochner Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -119,7 +119,7 @@
                pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = __SVR4_NPXCW__;
        else
                pcb->pcb_savefpu.sv_87.sv_env.en_cw = __SVR4_NPXCW__;
-       tf->tf_cs = GSEL(LUCODEBIG_SEL, SEL_UPL);
+       tf->tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL);
 }
 
 void *



Home | Main Index | Thread Index | Old Index