From f8154a63c091e13cc591d277b854ea3d45d91fc2 Mon Sep 17 00:00:00 2001 From: mycroft Date: Sun, 9 Jan 1994 14:59:42 +0000 Subject: [PATCH] Don't bogusly save the supervisor stack on signals. Correct PSL checks. Fix some return values from sigreturn(). --- sys/arch/i386/i386/machdep.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index a2a7682cfdeb..0bf4e333f127 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -452,7 +452,6 @@ sendsig(catcher, sig, mask, code) fp->sf_sc.sc_mask = mask; fp->sf_sc.sc_ebp = tf->tf_ebp; fp->sf_sc.sc_esp = tf->tf_esp; - fp->sf_sc.sc_isp = tf->tf_isp; fp->sf_sc.sc_eip = tf->tf_eip; fp->sf_sc.sc_efl = tf->tf_eflags; fp->sf_sc.sc_eax = tf->tf_eax; @@ -500,6 +499,7 @@ sigreturn(p, uap, retval) register struct sigcontext *scp; register struct sigframe *fp; register struct trapframe *tf; + int eflags; tf = (struct trapframe *)p->p_regs; @@ -513,19 +513,18 @@ sigreturn(p, uap, retval) ((caddr_t)scp - offsetof(struct sigframe, sf_sc)); if (useracc((caddr_t)fp, sizeof(*fp), 0) == 0) - return(EINVAL); + return(EFAULT); if (useracc((caddr_t)scp, sizeof(*scp), 0) == 0) + return(EFAULT); + + eflags = scp->sc_efl; + if ((eflags & PSL_USERCLR) != 0 || + (eflags & PSL_USERSET) != PSL_USERSET || + (eflags & PSL_IOPL) > (tf->tf_eflags & PSL_IOPL)) return(EINVAL); - /* make sure they aren't trying to do anything funny */ - if ((scp->sc_ps & PSL_MBZ) != 0 || (scp->sc_ps & PSL_MBO) != PSL_MBO) - return(EINVAL); - - /* compare IOPL; we can't insist that it's always 3 or the X server - will fail */ - if ((tf->tf_eflags & PSL_IOPL) < (scp->sc_efl & PSL_IOPL)) - return(EINVAL); + /* XXXXXX NEED TO VALIDATE SEGMENT REGISTERS */ p->p_sigacts->ps_onstack = scp->sc_onstack & 01; p->p_sigmask = scp->sc_mask &~ @@ -536,9 +535,8 @@ sigreturn(p, uap, retval) */ tf->tf_ebp = scp->sc_ebp; tf->tf_esp = scp->sc_esp; - tf->tf_isp = scp->sc_isp; tf->tf_eip = scp->sc_eip; - tf->tf_eflags = scp->sc_efl; + tf->tf_eflags = eflags; tf->tf_eax = scp->sc_eax; tf->tf_ebx = scp->sc_ebx; tf->tf_ecx = scp->sc_ecx; @@ -549,6 +547,7 @@ sigreturn(p, uap, retval) tf->tf_ds = scp->sc_ds; tf->tf_es = scp->sc_es; tf->tf_ss = scp->sc_ss; + return(EJUSTRETURN); }