If trap() is called when ddb is active, then go directly to trap_fatal();

do not blunder around enabling interrupts and running trap handlers.
trap_pfault() will normally pass control to ddb's fault handler which
will normally do the right thing.

This bug is very old. but in old versions of FreeBSD it is probably only
serious for trap handling that involves sleeping.  In -current, attempting
to examine unmapped memory while stopped at a breakpoint at mi_switch()
was always fatal.
This commit is contained in:
Bruce Evans 2002-06-12 13:30:52 +00:00
parent 6414f0b970
commit 98bcdec469
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98145
2 changed files with 18 additions and 4 deletions

View file

@ -190,6 +190,15 @@ trap(frame)
#endif
atomic_add_int(&cnt.v_trap, 1);
type = frame.tf_trapno;
#ifdef DDB
if (db_active) {
eva = (type == T_PAGEFLT ? rcr2() : 0);
trap_fatal(&frame, eva);
goto out;
}
#endif
if ((frame.tf_eflags & PSL_I) == 0) {
/*
@ -199,7 +208,6 @@ trap(frame)
* interrupts disabled until they are accidentally
* enabled later.
*/
type = frame.tf_trapno;
if (ISPL(frame.tf_cs) == SEL_UPL || (frame.tf_eflags & PSL_VM))
printf(
"pid %ld (%s): trap %d with interrupts disabled\n",
@ -222,7 +230,6 @@ trap(frame)
}
eva = 0;
type = frame.tf_trapno;
code = frame.tf_err;
if (type == T_PAGEFLT) {
/*

View file

@ -190,6 +190,15 @@ trap(frame)
#endif
atomic_add_int(&cnt.v_trap, 1);
type = frame.tf_trapno;
#ifdef DDB
if (db_active) {
eva = (type == T_PAGEFLT ? rcr2() : 0);
trap_fatal(&frame, eva);
goto out;
}
#endif
if ((frame.tf_eflags & PSL_I) == 0) {
/*
@ -199,7 +208,6 @@ trap(frame)
* interrupts disabled until they are accidentally
* enabled later.
*/
type = frame.tf_trapno;
if (ISPL(frame.tf_cs) == SEL_UPL || (frame.tf_eflags & PSL_VM))
printf(
"pid %ld (%s): trap %d with interrupts disabled\n",
@ -222,7 +230,6 @@ trap(frame)
}
eva = 0;
type = frame.tf_trapno;
code = frame.tf_err;
if (type == T_PAGEFLT) {
/*