From 8feb5d575d4cf9177b40fb2dbecc247dbd8490d9 Mon Sep 17 00:00:00 2001 From: Peter Holm Date: Sun, 21 Nov 1999 14:46:43 +0000 Subject: [PATCH] Moved useracc() to top of sigreturn as to avoid panic caused by invalid arguments to rutine. Reviewed by: marcel, phk --- sys/amd64/amd64/machdep.c | 8 ++++---- sys/i386/i386/machdep.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 280227247e40..1c0d37d4ff80 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -873,16 +873,16 @@ sigreturn(p, uap) ucontext_t *ucp; int cs, eflags; + ucp = uap->sigcntxp; + if (!useracc((caddr_t)ucp, sizeof(ucontext_t), VM_PROT_READ)) + return(EFAULT); + if (((struct osigcontext *)uap->sigcntxp)->sc_trapno == 0x01d516) return osigreturn(p, (struct osigreturn_args *)uap); regs = p->p_md.md_regs; - ucp = uap->sigcntxp; eflags = ucp->uc_mcontext.mc_eflags; - if (!useracc((caddr_t)ucp, sizeof(ucontext_t), VM_PROT_READ)) - return(EFAULT); - if (eflags & PSL_VM) { struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs; struct vm86_kernel *vm86; diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 280227247e40..1c0d37d4ff80 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -873,16 +873,16 @@ sigreturn(p, uap) ucontext_t *ucp; int cs, eflags; + ucp = uap->sigcntxp; + if (!useracc((caddr_t)ucp, sizeof(ucontext_t), VM_PROT_READ)) + return(EFAULT); + if (((struct osigcontext *)uap->sigcntxp)->sc_trapno == 0x01d516) return osigreturn(p, (struct osigreturn_args *)uap); regs = p->p_md.md_regs; - ucp = uap->sigcntxp; eflags = ucp->uc_mcontext.mc_eflags; - if (!useracc((caddr_t)ucp, sizeof(ucontext_t), VM_PROT_READ)) - return(EFAULT); - if (eflags & PSL_VM) { struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs; struct vm86_kernel *vm86;