Subject: kern/26244: Add HALT_IS_REBOOT feature to the kernel
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <pancake@phreaker.net>
List: netbsd-bugs
Date: 07/11/2004 13:44:55
>Number:         26244
>Category:       kern
>Synopsis:       HALT_IS_REBOOT feature
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 11 11:38:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     pancake
>Release:        NetBSD 2.0E
>Organization:
	
>Environment:
	
	
System: NetBSD panser 2.0E NetBSD 2.0E (PANCAKE-PANSER-SERVER) #2: Fri May 14 16:49:29 CEST 2004 root@panser:/usr/src/sys/arch/i386/compile/PANCAKE_PANSER i386
Architecture: i386
Machine: i386
>Description:
	This option to the kernel allows administrators to be sure that nobody
	will be able to halt your box without physical access.
	
>How-To-Repeat:
	Apply the patch and type "halt" in cmdline
	
>Fix:
	This is the patch:

--- kern/uipc_socket.c.orig	2004-07-02 00:08:03.000000000 +0200
+++ kern/uipc_socket.c	2004-07-11 13:38:10.000000000 +0200
@@ -1346,9 +1346,13 @@
 
 	if (how == SHUT_RD || how == SHUT_RDWR)
 		sorflush(so);
+#ifdef HALT_IS_REBOOT
+	cpu_reboot(RB_AUTOBOOT,"WARNING: System rebooted by HALT.");
+#else
 	if (how == SHUT_WR || how == SHUT_RDWR)
 		return (*pr->pr_usrreq)(so, PRU_SHUTDOWN, (struct mbuf *)0,
 		    (struct mbuf *)0, (struct mbuf *)0, (struct proc *)0);
+#endif
 	return (0);
 }
 
>Release-Note:
>Audit-Trail:
>Unformatted: