From nobody@FreeBSD.org  Thu Nov 25 19:16:41 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id F27D616A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 25 Nov 2004 19:16:41 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DF06643D2F
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 25 Nov 2004 19:16:41 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iAPJGfGA082950
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 25 Nov 2004 19:16:41 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iAPJGfqL082949;
	Thu, 25 Nov 2004 19:16:41 GMT
	(envelope-from nobody)
Message-Id: <200411251916.iAPJGfqL082949@www.freebsd.org>
Date: Thu, 25 Nov 2004 19:16:41 GMT
From: Alex Hoff <ahoff@sandvine.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Killing watchdogd does not shutdown watchdog
X-Send-Pr-Version: www-2.3

>Number:         74386
>Category:       kern
>Synopsis:       [kernel] [patch] Killing watchdogd does not shutdown watchdog
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    emaste
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 25 19:20:31 GMT 2004
>Closed-Date:    Tue Jan 03 19:00:31 GMT 2006
>Last-Modified:  Tue Jan 03 19:00:31 GMT 2006
>Originator:     Alex Hoff
>Release:        5.3 RELEASE
>Organization:
Sandvine Inc
>Environment:
FreeBSD 5.3 Release
>Description:
watchdogd when exiting will with remove the WD_ACTIVE flag by calling wd_ioctl with that bit set to 0. This is supposed to disable the watchdog, but since kern_clock.c:watchdog_config does not check to see if the ACTIVE flag is set, it will NEVER hit the "watchdog_enabled = 0;" code. Thus, when you kill watchdogd and stop kicking the watchdog, it will panic. 
>How-To-Repeat:
Load the software watchdog and kill watchdogd. The kernel should panic in ~15 seconds (depending on your timeout).
>Fix:
Patch:
Check to make sure the watchdog is actually active. Also remove duplicate WD_INTERVAL line.
--- kern_clock.c        2004-11-25 14:01:59.000000000 -0500
+++ kern_clock.old      2004-11-25 14:01:41.000000000 -0500
@@ -503,7 +503,8 @@
        u_int u;

        u = cmd & WD_INTERVAL;
+       if ((cmd & WD_ACTIVE) && u >= WD_TO_1SEC) {
-       if (cmd && u >= WD_TO_1SEC) {
-               u = cmd & WD_INTERVAL;
                watchdog_ticks = (1 << (u - WD_TO_1SEC)) * hz;
                watchdog_enabled = 1;
                *err = 0;
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->phk 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Sat Dec 11 21:27:06 GMT 2004 
Responsible-Changed-Why:  
Poul-Henning is author of the code under question. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74386 
Responsible-Changed-From-To: phk->emaste 
Responsible-Changed-By: emaste 
Responsible-Changed-When: Wed Oct 26 20:19:58 GMT 2005 
Responsible-Changed-Why:  
I'm going to take care of this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74386 
State-Changed-From-To: open->patched 
State-Changed-By: emaste 
State-Changed-When: Thu Oct 27 17:24:16 GMT 2005 
State-Changed-Why:  
Patch committed to kern_clock.c 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74386 
State-Changed-From-To: patched->closed 
State-Changed-By: emaste 
State-Changed-When: Tue Jan 3 18:47:14 UTC 2006 
State-Changed-Why:  
Fix merged back to RELENG_5 and RELENG_6 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74386 
>Unformatted:
