Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 2010 19:28:44 GMT
From:      John Giacomoni <John.Giacomoni@LineRateSystems.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/149591: struct callout:c_flags should be volatile
Message-ID:  <201008121928.o7CJSiOE043212@www.freebsd.org>
Resent-Message-ID: <201008121930.o7CJU9Td039809@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         149591
>Category:       kern
>Synopsis:       struct callout:c_flags should be volatile
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 12 19:30:09 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     John Giacomoni
>Release:        7.3/8.1
>Organization:
LineRate Systems
>Environment:
>Description:
The following code sequence can result in an infinite loop (even if the callout invokes callout_deactivate()

while(callout_active()) DELAY();

The problem is that callout_active checks c_flags to check if a callout timer is active.

However, unless c_flags are volatile, the compiler can cache the value of c_flags in a register and thus fail to notice a change in state when repeatedly called from within a single scope.
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008121928.o7CJSiOE043212>