Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Feb 2003 00:39:01 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        current@FreeBSD.ORG
Subject:   Re: Dumping broken?
Message-ID:  <20030209000140.H18099-100000@gamplex.bde.org>
In-Reply-To: <20030208111854.GA13178@rot13.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 8 Feb 2003, Kris Kennaway wrote:

> I'm having lots of problems with crashdumps under 5.0.  Most of the
> time trying to force a dump via 'call doadump' returns an error about
> 'Context switches not permitted in the debugger'.  Calling it again
> causes the system to hang.  Is anyone else seeing this?

This might be caused by ddb not disabling interrupts or by a driver
bug (not keeping interrupts disabled, or not using polled mode for
dumping so that dumping can work with interrupts disabled, or going
near a mutex for dumping).  If you call doadump() after ddb was invoked
for certain fatal traps, then the
'Context switches not permitted in the debugger' is probably normal
because of an old bug in ddb (it doesn't run with interrupts disabled
in this case).  Try the enclosed patch.  Calls from ddb invoked by
panic() shouldn't have this problem, but panic() is very likely to
hang or die on a lock even before it gets to doadump().

%%%
Index: db_interface.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/db_interface.c,v
retrieving revision 1.69
diff -u -2 -r1.69 db_interface.c
--- db_interface.c	21 Sep 2002 18:53:58 -0000	1.69
+++ db_interface.c	21 Sep 2002 23:56:57 -0000
@@ -78,4 +78,5 @@
 kdb_trap(int type, int code, struct i386_saved_state *regs)
 {
+	u_int ef;
 	volatile int ddb_mode = !(boothowto & RB_GDB);

@@ -97,4 +98,8 @@
 	}

+	/* XXX is this correctly placed?  SMP restart seems to be too early. */
+	ef = read_eflags();
+	disable_intr();
+
 	switch (type) {
 	    case T_BPTFLT:	/* breakpoint */
@@ -217,4 +222,7 @@
 	regs->tf_cs     = ddb_regs.tf_cs & 0xffff;
 	regs->tf_ds     = ddb_regs.tf_ds & 0xffff;
+
+	write_eflags(ef);
+
 	return (1);
 }
%%%

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030209000140.H18099-100000>