mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 22:32:30 +01:00
Implement a simple hook (or hack?) to allow graphics device console
drivers to protect DDB from being invoked while the console is in process-controlled (i.e., graphics) mode. Implement the logic to use this hook from within pcvt. (I'm sure Søren will do the syscons part RSN). I've still got one occasion where the system stalled, but my attempts to trigger the situation artificially resulted int the expected behaviour. It's hard to track bugs without the console and DDB available. :-/
This commit is contained in:
parent
60ca0bff59
commit
4fb0b0de3e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7680
@ -23,7 +23,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: db_interface.c,v 1.11 1995/01/14 10:24:48 bde Exp $
|
||||
* $Id: db_interface.c,v 1.12 1995/03/16 18:11:25 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -38,6 +38,8 @@
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/segments.h>
|
||||
|
||||
#include <machine/cons.h> /* XXX: import cons_unavail */
|
||||
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
#include <vm/pmap.h>
|
||||
@ -79,6 +81,10 @@ kdb_trap(type, code, regs)
|
||||
return(0);
|
||||
#endif
|
||||
|
||||
/* XXX: do not block forever while the console is in graphics mode */
|
||||
if(cons_unavail)
|
||||
return 0;
|
||||
|
||||
switch (type) {
|
||||
case T_BPTFLT: /* breakpoint */
|
||||
case T_TRCTRAP: /* debug exception */
|
||||
@ -239,7 +245,11 @@ Debugger(msg)
|
||||
const char *msg;
|
||||
{
|
||||
static volatile u_char in_Debugger;
|
||||
|
||||
|
||||
/* XXX: do not block forever while the console is in graphics mode */
|
||||
if(cons_unavail)
|
||||
return;
|
||||
|
||||
if (!in_Debugger) {
|
||||
in_Debugger = 1;
|
||||
db_printf("Debugger(\"%s\")\n", msg);
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.23 1995/02/26 03:15:36 bde Exp $
|
||||
* $Id: cons.c,v 1.24 1995/04/02 16:14:51 joerg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -73,6 +73,10 @@ static struct consdev constab[] = {
|
||||
|
||||
struct tty *constty = 0; /* virtual console output device */
|
||||
struct tty *cn_tty; /* XXX: console tty struct for tprintf */
|
||||
int cons_unavail = 0; /* XXX:
|
||||
* physical console not available for
|
||||
* input (i.e., it is in graphics mode)
|
||||
*/
|
||||
|
||||
static u_char cn_is_open; /* nonzero if logical console is open */
|
||||
static u_char cn_phys_is_open; /* nonzero if physical console is open */
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.h,v 1.5 1994/05/25 08:53:05 rgrimes Exp $
|
||||
* $Id: cons.h,v 1.6 1994/10/20 00:07:46 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CONS_H_
|
||||
@ -66,6 +66,7 @@ struct consdev {
|
||||
extern struct consdev constab[];
|
||||
extern struct consdev *cn_tab;
|
||||
extern struct tty *cn_tty;
|
||||
extern int cons_unavail;
|
||||
|
||||
struct proc; struct uio;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: db_interface.c,v 1.11 1995/01/14 10:24:48 bde Exp $
|
||||
* $Id: db_interface.c,v 1.12 1995/03/16 18:11:25 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -38,6 +38,8 @@
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/segments.h>
|
||||
|
||||
#include <machine/cons.h> /* XXX: import cons_unavail */
|
||||
|
||||
#include <ddb/ddb.h>
|
||||
|
||||
#include <vm/pmap.h>
|
||||
@ -79,6 +81,10 @@ kdb_trap(type, code, regs)
|
||||
return(0);
|
||||
#endif
|
||||
|
||||
/* XXX: do not block forever while the console is in graphics mode */
|
||||
if(cons_unavail)
|
||||
return 0;
|
||||
|
||||
switch (type) {
|
||||
case T_BPTFLT: /* breakpoint */
|
||||
case T_TRCTRAP: /* debug exception */
|
||||
@ -239,7 +245,11 @@ Debugger(msg)
|
||||
const char *msg;
|
||||
{
|
||||
static volatile u_char in_Debugger;
|
||||
|
||||
|
||||
/* XXX: do not block forever while the console is in graphics mode */
|
||||
if(cons_unavail)
|
||||
return;
|
||||
|
||||
if (!in_Debugger) {
|
||||
in_Debugger = 1;
|
||||
db_printf("Debugger(\"%s\")\n", msg);
|
||||
|
@ -2427,8 +2427,19 @@ vgapage(int new_screen)
|
||||
psignal(vsp->proc, vsp->smode.acqsig);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we are committed */
|
||||
vt_switch_pending = 0;
|
||||
#if PCVT_FREEBSD > 206
|
||||
/*
|
||||
* XXX: If pcvt is acting as the systems console,
|
||||
* avoid panics going to the debugger while we are in
|
||||
* process mode.
|
||||
*/
|
||||
if(pcvt_is_console)
|
||||
cons_unavail = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2498,6 +2509,15 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
vsp->proc = p;
|
||||
vsp->pid = p->p_pid;
|
||||
|
||||
#if PCVT_FREEBSD > 206
|
||||
/*
|
||||
* XXX: If pcvt is acting as the systems console,
|
||||
* avoid panics going to the debugger while we are in
|
||||
* process mode.
|
||||
*/
|
||||
if(pcvt_is_console)
|
||||
cons_unavail = (newmode.mode == VT_PROCESS);
|
||||
#endif
|
||||
splx(opri);
|
||||
return 0;
|
||||
|
||||
@ -2564,9 +2584,16 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
vsp->smode.acqsig);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we are committed */
|
||||
vt_switch_pending = 0;
|
||||
return 0;
|
||||
#if PCVT_FREEBSD > 206
|
||||
/* XXX */
|
||||
if(pcvt_is_console)
|
||||
cons_unavail = 0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2575,6 +2602,11 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
if(vsp->vt_status & VT_WAIT_ACK) {
|
||||
vt_switch_pending = 0;
|
||||
vsp->vt_status &= ~VT_WAIT_ACK;
|
||||
#if PCVT_FREEBSD > 206
|
||||
/* XXX */
|
||||
if(pcvt_is_console)
|
||||
cons_unavail = 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
|
||||
* $Id: subr_prf.c,v 1.11 1995/03/16 18:12:40 bde Exp $
|
||||
* $Id: subr_prf.c,v 1.12 1995/04/01 20:18:43 joerg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -53,6 +53,7 @@
|
||||
#include <sys/tprintf.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <machine/cons.h>
|
||||
|
||||
/*
|
||||
* Note that stdarg.h and the ANSI style va_start macro is used for both
|
||||
@ -64,14 +65,14 @@
|
||||
#include <machine/kdbparam.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define TOCONS 0x01
|
||||
#define TOTTY 0x02
|
||||
#define TOLOG 0x04
|
||||
|
||||
struct tty *constty; /* pointer to console "window" tty */
|
||||
|
||||
extern cnputc(); /* standard console putc */
|
||||
int (*v_putc)() = cnputc; /* routine to putc on virtual console */
|
||||
void (*v_putc)(int) = cnputc; /* routine to putc on virtual console */
|
||||
|
||||
void logpri __P((int level));
|
||||
static void putchar __P((int ch, int flags, struct tty *tp));
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.23 1995/02/26 03:15:36 bde Exp $
|
||||
* $Id: cons.c,v 1.24 1995/04/02 16:14:51 joerg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -73,6 +73,10 @@ static struct consdev constab[] = {
|
||||
|
||||
struct tty *constty = 0; /* virtual console output device */
|
||||
struct tty *cn_tty; /* XXX: console tty struct for tprintf */
|
||||
int cons_unavail = 0; /* XXX:
|
||||
* physical console not available for
|
||||
* input (i.e., it is in graphics mode)
|
||||
*/
|
||||
|
||||
static u_char cn_is_open; /* nonzero if logical console is open */
|
||||
static u_char cn_phys_is_open; /* nonzero if physical console is open */
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.h,v 1.5 1994/05/25 08:53:05 rgrimes Exp $
|
||||
* $Id: cons.h,v 1.6 1994/10/20 00:07:46 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CONS_H_
|
||||
@ -66,6 +66,7 @@ struct consdev {
|
||||
extern struct consdev constab[];
|
||||
extern struct consdev *cn_tab;
|
||||
extern struct tty *cn_tty;
|
||||
extern int cons_unavail;
|
||||
|
||||
struct proc; struct uio;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user