From nobody@FreeBSD.ORG Mon Sep 13 04:27:58 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 6E37214D79; Mon, 13 Sep 1999 04:27:58 -0700 (PDT)
Message-Id: <19990913112758.6E37214D79@hub.freebsd.org>
Date: Mon, 13 Sep 1999 04:27:58 -0700 (PDT)
From: dima@server.ru
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: There is no way to force system panic from console
X-Send-Pr-Version: www-1.0

>Number:         13721
>Category:       kern
>Synopsis:       There is no way to force system panic from console
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    yokota
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 13 04:30:00 PDT 1999
>Closed-Date:    Fri Dec 10 01:37:19 PST 1999
>Last-Modified:  Fri Dec 10 01:38:25 PST 1999
>Originator:     Dmitry Kazarov
>Release:        FreeBSD 3.3-RC
>Organization:
Server
>Environment:
>Description:
Under some rare circumstances there is a real need to reboot system via kernel's panic from the system console. For example: if any process has ran out of memory nobody can login and even Ctrl-Alt-Del does not work and there is no way to find out source of the problem after cold boot.
And if reboot is not disabled the panic will not decrease the system's security especially; where enabling kernel debugger is not acceptable.

On Sun it is the only way to reboot the working system: OpenBoot prom on boot and reset commands at first checks whether Solaris is running and if it is running - calls its panic routine.
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->yokota 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Sep 14 06:17:38 PDT 1999 
Responsible-Changed-Why:  
The originator has diffs which may be of interest to Kazu. 

From: "Dmitry Kazarov" <dima@Server.RU>
To: "Sheldon Hearn" <sheldonh@uunet.co.za>
Cc:  
Subject: Re: kern/13721: There is no way to force system panic from console 
Date: Tue, 14 Sep 1999 17:13:08 +0400

 > On Mon, 13 Sep 1999 04:27:58 MST, dima@server.ru wrote:
 >
 > > And if reboot is not disabled the panic will not decrease the system's
 > > security especially; where enabling kernel debugger is not acceptable.
 >
 > So what do you suggest? :-)
 
 IMHO, it's needed to add something like this to
 /usr/src/sys/dev/syscons/syscons.c
 *** /usr/src/sys/dev/syscons/syscons.c Mon Aug 30 19:10:13 1999
 --- syscons.c   Tue Sep 14 12:56:51 1999
 *************** next_code:
 *** 3920,3925 ****
 --- 3920,3931 ----
   #endif
                 break;
 
 +           case PNC:
 + #ifndef SC_DISABLE_PANIC
 +               panic("Requested from console\n");
 + #endif
 +               break;
 +
   #if NAPM > 0
             case SUSP:
                 apm_suspend(PMST_SUSPEND);
 
 with corresponding changes in
 /usr/src/sys/{i386,alpha,...}/include/console.h,
 /usr/src/usr.sbin/kbdcontrol/* (and maybe elsewhere):
 
 
 *** /usr/src/usr.sbin/kbdcontrol/kbdcontrol.c Mon Aug 30 19:21:56 1999
 --- kbdcontrol.c Tue Sep 14 13:23:22 1999
 *************** get_entry()
 *** 181,186 ****
 --- 181,188 ----
   return SUSP | 0x100;
   case TSPSC:
   return SPSC | 0x100;
 + case TPANIC:
 + return PNC | 0x100;
   case TACC:
   if (ACC(number) > L_ACC)
   return -1;
 *************** print_entry(FILE *fp, int value)
 *** 388,393 ****
 --- 390,398 ----
   case SPSC | 0x100:
   fprintf(fp, " saver ");
   break;
 + case PNC | 0x100:
 + fprintf(fp, " panic ");
 + break;
   default:
   if (value & 0x100) {
   if (val >= F_FN && val <= L_FN)
 *************** dump_entry(int value)
 *** 556,561 ****
 --- 561,569 ----
   break;
   case SPSC:
   printf(" SPSC, ");
 + break;
 + case PNC:
 + printf("  PNC, ");
   break;
   default:
   if (value >= F_FN && value <= L_FN)
 
 
 
 *** /usr/src/usr.sbin/kbdcontrol/lex.h Mon Aug 30 19:21:56 1999
 --- lex.h Tue Sep 14 13:19:02 1999
 ***************
 *** 53,58 ****
 --- 53,59 ----
   #define TSUSP 278
   #define TACC 279
   #define TSPSC 280
 + #define TPANIC 281
 
   extern int number;
   extern char letter;
 
 
 
 *** /usr/src/sys/i386/include/console.h Mon Aug 30 19:11:11 1999
 --- console.h Tue Sep 14 13:26:16 1999
 *************** typedef struct {int kbd_delay[2];} keybo
 *** 443,448 ****
 --- 443,450 ----
 
   #define STBY 0x98 /* Go into standby mode (apm)   */
 
 + #define PNC 0x99 /* panic machine */
 +
   #define F(x) ((x)+F_FN-1)
   #define S(x) ((x)+F_SCR-1)
   #define ACC(x) ((x)+F_ACC)
 
 
 > Ciao,
 > Sheldon.
 >
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: yokota 
State-Changed-When: Fri Dec 10 01:37:19 PST 1999 
State-Changed-Why:  
Slightly different version of the patch has been committed to -CURRENT. 
Thank you. 
>Unformatted:
