Subject: Re: kpsignal2 panic
To: Andrey Petrov <petrov@netbsd.org>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 10/03/2003 15:02:54
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

>I guess it some races during process termination and signals because
>the following patch helps to avoid the panic. It certainly needs
>more investigation but hopefully it'll ring a bell to someone.
>
>         Andrey
>
>Index: kern_sig.c
>===================================================================
>RCS file: /cvsroot/src/sys/kern/kern_sig.c,v
>retrieving revision 1.163
>diff -u -p -r1.163 kern_sig.c
>--- kern_sig.c  3 Oct 2003 17:51:13 -0000       1.163
>+++ kern_sig.c  3 Oct 2003 21:48:24 -0000
>@@ -965,6 +965,15 @@ kpsignal1(struct proc *p, ksiginfo_t *ks
>                 size_t fd;
>                 struct filedesc *fdp = p->p_fd;
>                 ksi->ksi_fd = -1;
>+
>+               if (fdp == NULL) {
>+#if 0
>+                       printf("kpsignal1: fdp NULL, proc %d %d\n",
>+                              p->p_pid, p->p_stat);
>+#endif
>+                       return;
>+               }
>+
>                 for (fd = 0; fd < fdp->fd_nfiles; fd++) {
>                         struct file *fp = fdp->fd_ofiles[fd];
>                         /* XXX: lock? */

-- 
Matt Thomas                     email: matt@3am-software.com
3am Software Foundry              www: http://3am-software.com/bio/matt/
Cupertino, CA              disclaimer: I avow all knowledge of this message.