Date: Fri, 20 Jun 2003 10:08:31 -0500 (CDT) From: "Christian S.J. Peron" <maneo@bsdpro.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/53557: [patch]: kernel panic: fix for a divide by zero processor exception Message-ID: <200306201508.h5KF8Vgc000839@h24-79-64-13.wp.shawcable.net> Resent-Message-ID: <200306201510.h5KFAFq1027016@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306201508.h5KF8Vgc000839>