Subject: kern/10481: prevent rebooting on halt when no keyboard is in the kernel
To: None <gnats-bugs@gnats.netbsd.org>
From: Brook Milligan <brook@biology.nmsu.edu>
List: netbsd-bugs
Date: 06/29/2000 16:10:14
>Number: 10481
>Category: kern
>Synopsis: halt(8) causes a reboot when no keyboard device is configured in the kernel
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 29 16:11:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Brook Milligan
>Release: NetBSD/i386 1.4.2
>Organization:
Brook G. Milligan Internet: brook@nmsu.edu
Department of Biology
New Mexico State University Telephone: (505) 646-7980
Las Cruces, New Mexico 88003 U.S.A. FAX: (505) 646-5665
>Environment:
System: NetBSD biology.nmsu.edu 1.4 NetBSD 1.4 (BIOLOGY) #0: Tue Nov 23 11:51:18 MST 1999 root@biology.nmsu.edu:/usr/src/sys/arch/i386/compile/BIOLOGY i386
>Description:
the halt command will lead to rebooting when the kernel has no
keyboard devices configured. This occurs because under those
conditions executation falls through the cngetc() call in the
following code fragment (from arch/i386/i386/machdep.c):
if (howto & RB_HALT) {
printf("\n");
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");
cnpollc(1); /* for proper keyboard command handling */
cngetc();
cnpollc(0);
}
>How-To-Repeat:
System configuration: server-type system with no keyboard attached
Kernel config: no keyboard devices configured
issue halt command and watch the machine reboot
>Fix:
Apply the following patch to arch/i386/i386/machdep.c:
--- machdep.c.orig Fri Feb 4 16:09:35 2000
+++ machdep.c Thu May 25 12:44:36 2000
@@ -1375,10 +1375,15 @@
if (howto & RB_HALT) {
printf("\n");
printf("The operating system has halted.\n");
+#if (NPC > 0) && (NPCCONSKBD > 0)
printf("Please press any key to reboot.\n\n");
cnpollc(1); /* for proper keyboard command handling */
cngetc();
cnpollc(0);
+#else
+ for(;;) ;
+ /* NOT REACHED */
+#endif
}
printf("rebooting...\n");
>Release-Note:
>Audit-Trail:
>Unformatted: