Date: Mon, 21 Jan 2002 15:20:58 -0500 (EST) From: Andrew Gallatin <gallatin@cs.duke.edu> To: Bernd Walter <ticso@cicely8.cicely.de> Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: 4.5-RC panic Message-ID: <15436.30762.981497.880698@grasshopper.cs.duke.edu> In-Reply-To: <20020121172920.U58301@cicely8.cicely.de> References: <20020121035556.D58301@cicely8.cicely.de> <15436.8686.765933.505738@grasshopper.cs.duke.edu> <20020121172920.U58301@cicely8.cicely.de>
next in thread | previous in thread | raw e-mail | index | archive | help
I finally upgraded my crashbox to 4.5RC & I was able to duplicate the
problem here. I think I've fixed it with the following patch -- I
like it better than the first one because it is less complex & should
be faster in the common case.
I've also tested it w/an old copy of tcsh that calls the old
sigreturn, so I don't think I've messed up signals.
Comments?
Cheers,
Drew
Index: machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/alpha/alpha/machdep.c,v
retrieving revision 1.68.2.15
diff -u -r1.68.2.15 machdep.c
--- machdep.c 13 Dec 2001 19:18:00 -0000 1.68.2.15
+++ machdep.c 21 Jan 2002 20:10:19 -0000
@@ -1570,9 +1570,6 @@
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 @@
/*
* 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
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15436.30762.981497.880698>
