mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-10 16:31:18 +01:00
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:
parent
41a1d0d2b5
commit
9a46ff715e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53624
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user