summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gallatin <gallatin@FreeBSD.org>2002-01-22 02:40:39 +0000
committerAndrew Gallatin <gallatin@FreeBSD.org>2002-01-22 02:40:39 +0000
commit500c14f6af86c4782fe2627af04fe9c546ded5e3 (patch)
tree2cc9fe77bd4946261d41e613cfc79ffbd897abca
parent755a58526026e6df94d776a85fef0a5471f2e7d0 (diff)
Notes
-rw-r--r--sys/alpha/alpha/machdep.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 001a684f2c0f..50df8e755122 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -1513,11 +1513,6 @@ sigreturn(struct thread *td,
unsigned long val;
struct proc *p;
-#ifdef COMPAT_43
- if (((struct osigcontext*)uap->sigcntxp)->sc_regs[R_ZERO] == 0xACEDBADE)
- return osigreturn(td, (struct osigreturn_args *)uap);
-#endif
-
ucp = uap->sigcntxp;
pcb = td->td_pcb;
p = td->td_proc;
@@ -1529,9 +1524,22 @@ sigreturn(struct thread *td,
/*
* 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)))
+ if (copyin((caddr_t)ucp, (caddr_t)&uc, sizeof(ucontext_t))) {
+#ifdef COMPAT_43
+ if (((struct osigcontext*)&uc)->sc_regs[R_ZERO] == 0xACEDBADE)
+ return osigreturn(td, (struct osigreturn_args *)uap);
+#endif
return (EFAULT);
+ }
+
+#ifdef COMPAT_43
+ if (((struct osigcontext*)&uc)->sc_regs[R_ZERO] == 0xACEDBADE)
+ return osigreturn(td, (struct osigreturn_args *)uap);
+#endif
/*
* Restore the user-supplied information