From 1c1f5b603c7684ab9fcf763f6348292ceb293c88 Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 19 Sep 2008 19:15:57 +0000 Subject: [PATCH] more paranoid eflags setting. --- sys/arch/i386/i386/compat_13_machdep.c | 7 ++++--- sys/arch/i386/i386/compat_16_machdep.c | 7 ++++--- sys/arch/i386/i386/freebsd_machdep.c | 7 ++++--- sys/arch/i386/i386/svr4_machdep.c | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/sys/arch/i386/i386/compat_13_machdep.c b/sys/arch/i386/i386/compat_13_machdep.c index 19851f79e29b..f7f159e971c1 100644 --- a/sys/arch/i386/i386/compat_13_machdep.c +++ b/sys/arch/i386/i386/compat_13_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.22 2008/04/28 20:23:24 martin Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.23 2008/09/19 19:15:57 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.22 2008/04/28 20:23:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23 2008/09/19 19:15:57 christos Exp $"); #include "opt_vm86.h" @@ -99,7 +99,8 @@ compat_13_sys_sigreturn(struct lwp *l, const struct compat_13_sys_sigreturn_args tf->tf_fs = context.sc_fs; tf->tf_es = context.sc_es; tf->tf_ds = context.sc_ds; - tf->tf_eflags = context.sc_eflags; + tf->tf_eflags &= ~PSL_USER; + tf->tf_eflags |= context.sc_eflags & PSL_USER; } tf->tf_edi = context.sc_edi; tf->tf_esi = context.sc_esi; diff --git a/sys/arch/i386/i386/compat_16_machdep.c b/sys/arch/i386/i386/compat_16_machdep.c index 410c6b4cafc8..68ac4fe824e5 100644 --- a/sys/arch/i386/i386/compat_16_machdep.c +++ b/sys/arch/i386/i386/compat_16_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_16_machdep.c,v 1.16 2008/04/28 20:23:24 martin Exp $ */ +/* $NetBSD: compat_16_machdep.c,v 1.17 2008/09/19 19:15:58 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.16 2008/04/28 20:23:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.17 2008/09/19 19:15:58 christos Exp $"); #include "opt_vm86.h" #include "opt_compat_netbsd.h" @@ -120,7 +120,8 @@ compat_16_sys___sigreturn14(struct lwp *l, const struct compat_16_sys___sigretur tf->tf_fs = context.sc_fs; tf->tf_es = context.sc_es; tf->tf_ds = context.sc_ds; - tf->tf_eflags = context.sc_eflags; + tf->tf_eflags &= ~PSL_USER; + tf->tf_eflags |= context.sc_eflags & PSL_USER; } tf->tf_edi = context.sc_edi; tf->tf_esi = context.sc_esi; diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c index 132245d4e6d6..5b1afa11d0b2 100644 --- a/sys/arch/i386/i386/freebsd_machdep.c +++ b/sys/arch/i386/i386/freebsd_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: freebsd_machdep.c,v 1.51 2008/04/28 20:23:24 martin Exp $ */ +/* $NetBSD: freebsd_machdep.c,v 1.52 2008/09/19 19:15:58 christos Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.51 2008/04/28 20:23:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.52 2008/09/19 19:15:58 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -228,7 +228,8 @@ freebsd_sys_sigreturn(struct lwp *l, const struct freebsd_sys_sigreturn_args *ua tf->tf_fs = context.sc_fs; tf->tf_es = context.sc_es; tf->tf_ds = context.sc_ds; - tf->tf_eflags = context.sc_efl; + tf->tf_eflags &= ~PSL_USER; + tf->tf_eflags |= context.sc_efl & PSL_USER; } tf->tf_edi = context.sc_edi; tf->tf_esi = context.sc_esi; diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c index e95bddad2393..86ea64919c8e 100644 --- a/sys/arch/i386/i386/svr4_machdep.c +++ b/sys/arch/i386/i386/svr4_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_machdep.c,v 1.91 2008/04/28 20:23:24 martin Exp $ */ +/* $NetBSD: svr4_machdep.c,v 1.92 2008/09/19 19:15:58 christos Exp $ */ /*- * Copyright (c) 1994, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.91 2008/04/28 20:23:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.92 2008/09/19 19:15:58 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -230,7 +230,8 @@ svr4_setmcontext(struct lwp *l, svr4_mcontext_t *mc, u_long flags) if (tf->tf_eflags & PSL_VM) (*p->p_emul->e_syscall_intern)(p); #endif - tf->tf_eflags = r[SVR4_X86_EFL]; + tf->tf_eflags &= ~PSL_USER; + tf->tf_eflags |= r[SVR4_X86_EFL] & PSL_USER; } tf->tf_edi = r[SVR4_X86_EDI]; tf->tf_esi = r[SVR4_X86_ESI];