Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 Apply only CCR. Otherwise userland ...



details:   https://anonhg.NetBSD.org/src/rev/b66252b461c3
branches:  trunk
changeset: 826222:b66252b461c3
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Aug 22 09:12:49 2017 +0000

description:
Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get
kernel privileges on the hardware.

ok martin

diffstat:

 sys/arch/sparc64/sparc64/compat_13_machdep.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 9cef1f6973a9 -r b66252b461c3 sys/arch/sparc64/sparc64/compat_13_machdep.c
--- a/sys/arch/sparc64/sparc64/compat_13_machdep.c      Tue Aug 22 08:26:42 2017 +0000
+++ b/sys/arch/sparc64/sparc64/compat_13_machdep.c      Tue Aug 22 09:12:49 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_13_machdep.c,v 1.23 2009/11/21 04:16:52 rmind Exp $     */
+/*     $NetBSD: compat_13_machdep.c,v 1.24 2017/08/22 09:12:49 maxv Exp $      */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23 2009/11/21 04:16:52 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.24 2017/08/22 09:12:49 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -129,7 +129,7 @@
                return (EINVAL);
        /* take only psr ICC field */
 #ifdef __arch64__
-       tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | scp->sc_tstate;
+       tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | (scp->sc_tstate & TSTATE_CCR);
 #else
        tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(scp->sc_psr);
 #endif



Home | Main Index | Thread Index | Old Index