kern/149591: struct callout:c_flags should be volatile

John Giacomoni John.Giacomoni at LineRateSystems.com
Thu Aug 12 19:30:09 UTC 2010


>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:


More information about the freebsd-bugs mailing list