summaryrefslogtreecommitdiff
path: root/sys/alpha
diff options
context:
space:
mode:
authorAndrew Gallatin <gallatin@FreeBSD.org>2002-01-22 15:12:46 +0000
committerAndrew Gallatin <gallatin@FreeBSD.org>2002-01-22 15:12:46 +0000
commit09cb477913cc0f4efc2268cfba7bd47513824bbf (patch)
treec1ae6ac3913a48534450fbcebc882a32a96508aa /sys/alpha
parent1e144b15928f4ae96a91c4867509a08ebfed50f1 (diff)
Notes
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/machdep.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 83411bcffd7b..afef0105b5dc 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -1570,9 +1570,6 @@ sigreturn(struct proc *p,
struct pcb *pcb;
unsigned long val;
- if (((struct osigcontext*)uap->sigcntxp)->sc_regs[R_ZERO] == 0xACEDBADE)
- return osigreturn(p, (struct osigreturn_args *)uap);
-
ucp = uap->sigcntxp;
pcb = &p->p_addr->u_pcb;
@@ -1583,9 +1580,19 @@ sigreturn(struct proc *p,
/*
* Fetch the entire context structure at once for speed.
+ * Note that struct osigcontext is smaller than a ucontext_t,
+ * so even if copyin() faults, we may have actually gotten a complete
+ * struct osigcontext.
*/
- if (copyin((caddr_t)ucp, (caddr_t)&uc, sizeof(ucontext_t)))
- return (EFAULT);
+ if (copyin((caddr_t)ucp, (caddr_t)&uc, sizeof(ucontext_t))) {
+ if (((struct osigcontext*)&uc)->sc_regs[R_ZERO] == 0xACEDBADE)
+ return osigreturn(p, (struct osigreturn_args *)uap);
+ else
+ return (EFAULT);
+ }
+
+ if (((struct osigcontext*)&uc)->sc_regs[R_ZERO] == 0xACEDBADE)
+ return osigreturn(p, (struct osigreturn_args *)uap);
/*
* Restore the user-supplied information