Subject: Re: kpsignal2 panic
To: Matt Thomas <matt@3am-software.com>
From: Andrey Petrov <petrov@netbsd.org>
List: tech-kern
Date: 10/03/2003 15:42:37
On Fri, Oct 03, 2003 at 03:02:54PM -0700, Matt Thomas wrote:
> At 02:54 PM 10/3/2003, Andrey Petrov wrote:
> >Hi,
> >
> >I upgraded pc164 alpha to very recent -current and found it panicing
> >right on exiting from emacs with display on another machine. The traceback
> >is (no serial console, just an excerpt)
> >
> >kpsignal1
> >fownsignal
> >sowakeup
> >tcp_input
> >...
>
> I think the proper test is checking for (p->p_flag & P_WEXIT) != 0
>
And it did fixes the problem. Here's another patch for review.
Index: kern_sig.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_sig.c,v
retrieving revision 1.163
diff -c -p -r1.163 kern_sig.c
*** kern_sig.c 3 Oct 2003 17:51:13 -0000 1.163
--- kern_sig.c 3 Oct 2003 22:34:42 -0000
*************** psignal1(struct proc *p, int signum, int
*** 961,970 ****
--- 961,983 ----
void
kpsignal1(struct proc *p, ksiginfo_t *ksi, void *data, int dolock)
{
+
+ if (p->p_flag & P_WEXIT)
+ return;
+
if (data) {
size_t fd;
struct filedesc *fdp = p->p_fd;
ksi->ksi_fd = -1;
+
+ if (fdp == NULL) {
+ #ifdef DIAGNOSTIC
+ printf("kpsignal1: fdp NULL, proc %d flags %x\n",
+ p->p_pid, p->p_flag);
+ #endif
+ return;
+ }
+
for (fd = 0; fd < fdp->fd_nfiles; fd++) {
struct file *fp = fdp->fd_ofiles[fd];
/* XXX: lock? */