Subject: port-i386/2124: core dump after panic doesn't work
To: None <gnats-bugs@NetBSD.ORG>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: netbsd-bugs
Date: 02/25/1996 21:34:02
>Number:         2124
>Category:       port-i386
>Synopsis:       core dump after panic doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 25 16:50:05 1996
>Last-Modified:
>Originator:     Juergen Hannken-Illjes
>Organization:
TU Braunschweig - EIS
	
>Release:        NetBSD-current as of Feb, 22.
>Environment:
	
System: NetBSD home 1.1A NetBSD 1.1A (CUSTOM) #5: Sun Feb 25 15:25:46 MET 1996 hannken@home:/usr/src/sys/arch/i386/compile/CUSTOM i386


>Description:
During sync after panic() vfs_shutdown() calls bwrite() with invalid curproc
and bombs at /sys/kern/vfs_bio.c, line 305:
			curproc->p_stats->p_ru.ru_oublock++;
	
>How-To-Repeat:
	
>Fix:
Index: sys/arch/i386/i386/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.190
diff -u -2 -r1.190 machdep.c
--- machdep.c	1996/02/18 22:44:27	1.190
+++ machdep.c	1996/02/25 17:11:46
@@ -702,4 +708,11 @@
 	boothowto = howto;
 	if ((howto&RB_NOSYNC) == 0 && waittime < 0) {
+#if 1
+		extern struct proc proc0;
+
+		/* protect against curproc->p_stats.foo refs in sync()   XXX */
+		if (curproc == NULL)
+			curproc = &proc0;
+#endif
 		waittime = 0;
 		vfs_shutdown();
	
>Audit-Trail:
>Unformatted: