Bug 13721

Summary: There is no way to force system panic from console
Product: Base System Reporter: dima <dima>
Component: kernAssignee: yokota <yokota>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description dima 1999-09-13 12:30:00 UTC
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.
Comment 1 dima 1999-09-14 14:13:08 UTC
> 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.
>
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 1999-09-14 14:17:38 UTC
Responsible Changed
From-To: freebsd-bugs->yokota

The originator has diffs which may be of interest to Kazu. 

Comment 3 yokota freebsd_committer freebsd_triage 1999-12-10 09:37:19 UTC
State Changed
From-To: open->closed

Slightly different version of the patch has been committed to -CURRENT. 
Thank you.