kern/72728: [patch] keyboard debug and reboot qualification moved into sysctl

Luca Morettoni morettoni at libero.it
Fri Oct 15 04:00:45 PDT 2004


>Number:         72728
>Category:       kern
>Synopsis:       [patch] keyboard debug and reboot qualification moved into sysctl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 15 11:00:45 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Luca Morettoni
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
Luca Morettoni
>Environment:
System: FreeBSD current.morettoni.local 6.0-CURRENT FreeBSD 6.0-CURRENT #33: Thu Oct 14 17:58:08 CEST 2004 luca at current.morettoni.local:/usr/obj/usr/src/sys/FRODO i386


	
>Description:
	This patch add to sysctl two new variables: hw.syscons.kbd_reboot and hw.syscons.kbd_debug
	The default value of this two are both 1, and that allow users to reboot and go into debug
	mode with keyboards shotcut. Setting them to 0 you can disable that at runtime.
	If you put SC_DISABLE_REBOOT and/or SC_DISABLE_KDBKEY in kernel config file that variables
	are set to 0 and you can't modify it.

>How-To-Repeat:
	
>Fix:

	Apply the following patch:

--- syscons.c.patch begins here ---
--- src/sys/dev/syscons/syscons.c.orig	Fri Oct 15 08:57:27 2004
+++ src/sys/dev/syscons/syscons.c	Thu Oct 14 17:06:23 2004
@@ -109,6 +109,19 @@
 static	int		saver_mode = CONS_NO_SAVER; /* LKM/user saver */
 static	int		run_scrn_saver = FALSE;	/* should run the saver? */
 static	int		enable_bell = TRUE; /* enable beeper */
+
+#ifndef SC_DISABLE_REBOOT
+static  int		enable_reboot = TRUE; /* enable keyboard reboot */
+#else
+static  int		enable_reboot = FALSE;
+#endif
+
+#ifndef SC_DISABLE_KDBKEY
+static  int		enable_kdb = TRUE; /* enable keyboard debug */
+#else
+static  int		enable_kdb = FALSE;
+#endif
+
 static	long        	scrn_blank_time = 0;    /* screen saver timeout value */
 #ifdef DEV_SPLASH
 static	int     	scrn_blanked;		/* # of blanked screen */
@@ -124,6 +137,14 @@
     &sc_saver_keyb_only, 0, "screen saver interrupted by input only");
 SYSCTL_INT(_hw_syscons, OID_AUTO, bell, CTLFLAG_RW, &enable_bell, 
     0, "enable bell");
+#ifndef SC_DISABLE_REBOOT
+SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_reboot, CTLFLAG_RW|CTLFLAG_SECURE, &enable_reboot,
+    0, "enable keyboard reboot");
+#endif
+#ifndef SC_DISABLE_KDBKEY
+SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_debug, CTLFLAG_RW|CTLFLAG_SECURE, &enable_kdb,
+    0, "enable keyboard debug");
+#endif
 #if !defined(SC_NO_FONT_LOADING) && defined(SC_DFLT_FONT)
 #include "font.h"
 #endif
@@ -3267,21 +3288,15 @@
 		break;
 
 	    case RBT:
-#ifndef SC_DISABLE_REBOOT
-		shutdown_nice(0);
-#endif
+		if (enable_reboot) shutdown_nice(0);
 		break;
 
 	    case HALT:
-#ifndef SC_DISABLE_REBOOT
-		shutdown_nice(RB_HALT);
-#endif
+		if (enable_reboot) shutdown_nice(RB_HALT);
 		break;
 
 	    case PDWN:
-#ifndef SC_DISABLE_REBOOT
-		shutdown_nice(RB_HALT|RB_POWEROFF);
-#endif
+		if (enable_reboot) shutdown_nice(RB_HALT|RB_POWEROFF);
 		break;
 
 	    case SUSP:
@@ -3292,9 +3307,7 @@
 		break;
 
 	    case DBG:
-#ifndef SC_DISABLE_KDBKEY
-		kdb_enter("manual escape to debugger");
-#endif
+		if (enable_kdb) kdb_enter("manual escape to debugger");
 		break;
 
 	    case PNC:
--- syscons.c.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list