[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
kernel/1035: traps causes DDB to be invoked even when ddb.panic = 0
>Number: 1035
>Category: kernel
>Synopsis: traps causes DDB to be invoked even when ddb.panic = 0
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bugs
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 29 09:40:01 MST 1999
>Last-Modified:
>Originator: Assar Westerlund
>Organization:
none
>Release: 2.6 and current
>Environment:
System : OpenBSD 2.6
Architecture: OpenBSD.i386
Machine : i386
>Description:
ddb is invoked on traps even when ddb.panic = 0. This makes it hard
to have ddb in the running kernel of a remote machine.
>How-To-Repeat:
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# Makefile
# trapmod.1
# trapmod.c
#
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
XLKM=trapmod
X
X.include <bsd.lkm.mk>
END-of-Makefile
echo x - trapmod.1
sed 's/^X//' >trapmod.1 << 'END-of-trapmod.1'
X.Dd December 29, 1999
X.Dt TRAP 8
X.Os
X.Sh NAME
X.Nm trapmod
X.Nd a kernel module that causes a trap
X.Sh DESCRIPTION
X.Nm
Xgenerates a trap when loaded that causes the kernel to either panic or
Xinvoke the debugger.
X.Sh EXAMPLES
Xmodload trapmod.o
X.Sh SEE ALSO
X.Xr lkm 4 ,
X.Xr modload 8 .
X.Sh STANDARDS
XNone (hopefully).
END-of-trapmod.1
echo x - trapmod.c
sed 's/^X//' >trapmod.c << 'END-of-trapmod.c'
X#include <sys/param.h>
X#include <sys/systm.h>
X#include <sys/conf.h>
X#include <sys/exec.h>
X#include <sys/lkm.h>
X
XMOD_MISC("trapmod")
X
Xint
Xtrapmod (struct lkm_table *lkmtp, int cmd, int ver)
X{
X return *((int *)0);
X}
END-of-trapmod.c
exit
>Fix:
Index: arch/i386/db_interface.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/db_interface.c,v
retrieving revision 1.6
diff -u -w -r1.6 db_interface.c
--- arch/i386/db_interface.c 1996/05/07 07:21:34 1.6
+++ arch/i386/db_interface.c 1999/12/29 16:31:30
@@ -48,8 +48,8 @@
#include <ddb/db_extern.h>
#include <ddb/db_access.h>
#include <ddb/db_output.h>
+#include <ddb/db_var.h>
-
extern label_t *db_recover;
extern char *trap_type[];
extern int trap_types;
@@ -83,17 +83,16 @@
{
int s;
-#if 0
- if ((boothowto&RB_KDB) == 0)
- return(0);
-#endif
-
switch (type) {
case T_BPTFLT: /* breakpoint */
case T_TRCTRAP: /* single_step */
+ case T_NMI: /* NMI */
case -1: /* keyboard interrupt */
break;
default:
+ if (!db_panic)
+ return (0);
+
kdbprinttrap(type, code);
if (db_recover != 0) {
db_error("Faulted in DDB; continuing...\n");
>Audit-Trail:
>Unformatted: