From owner-freebsd-bugs@FreeBSD.ORG Fri Jun 20 08:10:16 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 944B437B401 for ; Fri, 20 Jun 2003 08:10:16 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7CCE243F75 for ; Fri, 20 Jun 2003 08:10:15 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h5KFAFUp027017 for ; Fri, 20 Jun 2003 08:10:15 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h5KFAFq1027016; Fri, 20 Jun 2003 08:10:15 -0700 (PDT) Resent-Date: Fri, 20 Jun 2003 08:10:15 -0700 (PDT) Resent-Message-Id: <200306201510.h5KFAFq1027016@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Christian S.J. Peron" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AB69D37B401 for ; Fri, 20 Jun 2003 08:08:44 -0700 (PDT) Received: from h24-79-64-13.wp.shawcable.net (h24-79-64-13.wp.shawcable.net [24.79.64.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6578B43FAF for ; Fri, 20 Jun 2003 08:08:43 -0700 (PDT) (envelope-from modulus@h24-79-64-13.wp.shawcable.net) Received: from h24-79-64-13.wp.shawcable.net (localhost [127.0.0.1]) h5KF8V6g000840 for ; Fri, 20 Jun 2003 10:08:31 -0500 (CDT) (envelope-from modulus@h24-79-64-13.wp.shawcable.net) Received: (from root@localhost)h5KF8Vgc000839; Fri, 20 Jun 2003 10:08:31 -0500 (CDT) Message-Id: <200306201508.h5KF8Vgc000839@h24-79-64-13.wp.shawcable.net> Date: Fri, 20 Jun 2003 10:08:31 -0500 (CDT) From: "Christian S.J. Peron" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/53557: [patch]: kernel panic: fix for a divide by zero processor exception X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "Christian S.J. Peron" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2003 15:10:17 -0000 >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: