kern/53557: [patch]: kernel panic: fix for a divide by zero
processor exception
Christian S.J. Peron
maneo at bsdpro.com
Fri Jun 20 08:10:17 PDT 2003
>Number: 53557
>Category: kern
>Synopsis: [patch]: kernel panic: fix for a divide by zero processor exception
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Jun 20 08:10:14 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Christian S.J. Peron
>Release: FreeBSD 5.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD h24-79-64-13 5.1-RELEASE FreeBSD 5.1-RELEASE #5: Fri Jun 20 09:49:44 CDT 2003 maneo at movl:/usr/src/sys/i386/compile/RAID0 i386
>Description:
If root sets the kern.log_wakeups_per_second variable to 0
the next time the callback for the syslog wakeup gets scheduled
it will panic due to divide by zero machine exception.
>How-To-Repeat:
sysctl kern.log_wakeups_per_second=0
>Fix:
I have enclosed a patch that appears to fix the problem:
--- /usr/src/sys/kern/subr_log.c.bak Fri Jun 20 09:14:12 2003
+++ /usr/src/sys/kern/subr_log.c Fri Jun 20 09:45:04 2003
@@ -99,6 +99,17 @@
log_open = 1;
callout_init(&logsoftc.sc_callout, 0);
fsetown(td->td_proc->p_pid, &logsoftc.sc_sigio); /* signal process only */
+
+ /*
+ * Check to make sure the `log_wakeups_per_second' sysctl variable
+ * is sane so that we avoid a divide by zero machine exception.
+ */
+ if (!log_wakeups_per_second) {
+ printf("syslog wakeup is less then one. Adjusting to "
+ "one wakeup per second.\n");
+ log_wakeups_per_second = 1;
+ }
+
callout_reset(&logsoftc.sc_callout, hz / log_wakeups_per_second,
logtimeout, NULL);
return (0);
@@ -181,6 +192,17 @@
if (!log_open)
return;
+
+ /*
+ * Check to make sure the `log_wakeups_per_second' sysctl variable
+ * is sane so that we avoid a divide by zero machine exception.
+ */
+ if (!log_wakeups_per_second) {
+ printf("syslog wakeup is less then one. Adjusting to "
+ "one wakeup per second.\n");
+ log_wakeups_per_second = 1;
+ }
+
if (msgbuftrigger == 0) {
callout_reset(&logsoftc.sc_callout,
hz / log_wakeups_per_second, logtimeout, NULL);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list