Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64 in check_mcontext32(), accept the LDT selecto...



details:   https://anonhg.NetBSD.org/src/rev/fc347868185b
branches:  trunk
changeset: 757559:fc347868185b
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Sep 05 20:14:39 2010 +0000

description:
in check_mcontext32(), accept the LDT selector for 32-bit user code
as well as the GDT selector.  fixes PR 43835.

diffstat:

 sys/arch/amd64/amd64/netbsd32_machdep.c |  6 +++---
 sys/arch/amd64/include/segments.h       |  4 +---
 2 files changed, 4 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r 8b3574f64492 -r fc347868185b sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Sun Sep 05 18:03:37 2010 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Sun Sep 05 20:14:39 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.65 2010/08/08 18:13:54 chs Exp $        */
+/*     $NetBSD: netbsd32_machdep.c,v 1.66 2010/09/05 20:14:39 chs Exp $        */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.65 2010/08/08 18:13:54 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.66 2010/09/05 20:14:39 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -991,7 +991,7 @@
        pcb = lwp_getpcb(l);
 
        if (((gr[_REG32_EFL] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0 ||
-           gr[_REG32_CS] != GSEL(GUCODE32_SEL, SEL_UPL))
+           !VALID_USER_CSEL32(gr[_REG32_CS]))
                return EINVAL;
        if (gr[_REG32_FS] != 0 && !VALID_USER_DSEL32(gr[_REG32_FS]) &&
            !(gr[_REG32_FS] == GSEL(GUFS_SEL, SEL_UPL) && pcb->pcb_fs != 0))
diff -r 8b3574f64492 -r fc347868185b sys/arch/amd64/include/segments.h
--- a/sys/arch/amd64/include/segments.h Sun Sep 05 18:03:37 2010 +0000
+++ b/sys/arch/amd64/include/segments.h Sun Sep 05 20:14:39 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: segments.h,v 1.20 2010/07/07 01:14:52 chs Exp $        */
+/*     $NetBSD: segments.h,v 1.21 2010/09/05 20:14:40 chs Exp $        */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -395,10 +395,8 @@
 #define VALID_USER_DSEL32(s) \
     (((s) & 0xffff) == GSEL(GUDATA32_SEL, SEL_UPL) || \
      ((s) & 0xffff) == LSEL(LUDATA32_SEL, SEL_UPL))
-#if 0 /* not used */
 #define VALID_USER_CSEL32(s) \
     ((s) == GSEL(GUCODE32_SEL, SEL_UPL) || (s) == LSEL(LUCODE32_SEL, SEL_UPL))
-#endif
 
 #define VALID_USER_CSEL(s) \
     ((s) == GSEL(GUCODE_SEL, SEL_UPL) || (s) == LSEL(LUCODE_SEL, SEL_UPL))



Home | Main Index | Thread Index | Old Index