Fix a confusion between osigcontext and ucontext_t in the previous commit.

Since an osigcontext is smaller, if you check for a valid (much larger sized)
ucontext_t and it fails, we bogusly would reject the osigcontext as per
rev 1.378.  Instead, check for osigcontext range validity first, and
ucontext_t later.  This unbreaks Netscape.

Pointed to the right commit by:	peter
This commit is contained in:
Brian Feldman 1999-11-23 04:09:13 +00:00
parent 41a1d0d2b5
commit 9a46ff715e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53624
2 changed files with 32 additions and 12 deletions

View File

@ -533,7 +533,7 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
else {
/* Old FreeBSD-style arguments. */
sf.sf_arg2 = code;
sf.sf_addr = regs->tf_err;
sf.sf_addr = (register_t *)regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
@ -686,7 +686,7 @@ sendsig(catcher, sig, mask, code)
else {
/* Old FreeBSD-style arguments. */
sf.sf_siginfo = code;
sf.sf_addr = regs->tf_err;
sf.sf_addr = (register_t *)regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
@ -874,11 +874,21 @@ sigreturn(p, uap)
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);
if (!useracc((caddr_t)ucp, sizeof(struct osigcontext), VM_PROT_READ))
return (EFAULT);
if (((struct osigcontext *)ucp)->sc_trapno == 0x01d516)
return (osigreturn(p, (struct osigreturn_args *)uap));
/*
* Since ucp is not an osigcontext but a ucontext_t, we have to
* check again if all of it is accessible. A ucontext_t is
* much larger, so instead of just checking for the pointer
* being valid for the size of an osigcontext, now check for
* it being valid for a whole, new-style ucontext_t.
*/
if (!useracc((caddr_t)ucp, sizeof(ucontext_t), VM_PROT_READ))
return (EFAULT);
regs = p->p_md.md_regs;
eflags = ucp->uc_mcontext.mc_eflags;

View File

@ -533,7 +533,7 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
else {
/* Old FreeBSD-style arguments. */
sf.sf_arg2 = code;
sf.sf_addr = regs->tf_err;
sf.sf_addr = (register_t *)regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
@ -686,7 +686,7 @@ sendsig(catcher, sig, mask, code)
else {
/* Old FreeBSD-style arguments. */
sf.sf_siginfo = code;
sf.sf_addr = regs->tf_err;
sf.sf_addr = (register_t *)regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
@ -874,11 +874,21 @@ sigreturn(p, uap)
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);
if (!useracc((caddr_t)ucp, sizeof(struct osigcontext), VM_PROT_READ))
return (EFAULT);
if (((struct osigcontext *)ucp)->sc_trapno == 0x01d516)
return (osigreturn(p, (struct osigreturn_args *)uap));
/*
* Since ucp is not an osigcontext but a ucontext_t, we have to
* check again if all of it is accessible. A ucontext_t is
* much larger, so instead of just checking for the pointer
* being valid for the size of an osigcontext, now check for
* it being valid for a whole, new-style ucontext_t.
*/
if (!useracc((caddr_t)ucp, sizeof(ucontext_t), VM_PROT_READ))
return (EFAULT);
regs = p->p_md.md_regs;
eflags = ucp->uc_mcontext.mc_eflags;