From root@borgsdemons.com  Thu Oct  4 05:11:01 2007
Return-Path: <root@borgsdemons.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA14716A474
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  4 Oct 2007 05:11:01 +0000 (UTC)
	(envelope-from root@borgsdemons.com)
Received: from icarus.it.wsu.edu (icarus.it.wsu.edu [134.121.1.46])
	by mx1.freebsd.org (Postfix) with ESMTP id 949CA13C457
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  4 Oct 2007 05:11:01 +0000 (UTC)
	(envelope-from root@borgsdemons.com)
Received: from borgdemon3.temp.wsu.edu (res244074.resnet.wsu.edu [134.121.244.74])
	by icarus.it.wsu.edu (8.13.6/8.13.6) with ESMTP id l944lm1n095466
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 3 Oct 2007 21:47:48 -0700 (PDT)
Received: by borgdemon3.temp.wsu.edu (Postfix, from userid 0)
	id A4BE239829; Wed,  3 Oct 2007 19:56:46 -0700 (PDT)
Message-Id: <20071004025646.A4BE239829@borgdemon3.temp.wsu.edu>
Date: Wed,  3 Oct 2007 19:56:46 -0700 (PDT)
From: John Merryweather Cooper <john_m_cooper@yahoo.com>
Reply-To: John Merryweather Cooper <j.m.cooper@borgsdemons.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Lock Order Reversal on Current for kbd and zyd
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         116886
>Category:       kern
>Synopsis:       [zyd] [lor] Lock Order Reversal on Current for kbd and zyd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    weongyo
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 04 05:20:03 GMT 2007
>Closed-Date:    Fri May 23 05:10:24 UTC 2008
>Last-Modified:  Fri May 23 05:10:24 UTC 2008
>Originator:     John Merryweather Cooper
>Release:        FreeBSD 7.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD borgdemon3.temp.wsu.edu 7.0-CURRENT FreeBSD 7.0-CURRENT #8: Mon Oct 1 12:32:21 PDT 2007 root@borgdemon3.temp.wsu.edu:/usr/obj/usr/src/sys/TURION amd64


	
>Description:
	When the zyd0 interface first takes a DHCP IP (or when it roams),
	it usually (but not always) throws the attach lock order reversal.
	Rarely, the machine will lock up as a result.
>How-To-Repeat:
	When interface takes a DHCP IP address or roams.
>Fix:

	unknown

--- lock-order-reversal begins here ---
Oct  3 19:27:26 borgdemon3 kernel: lock order reversal: (Giant after non-sleepable)
Oct  3 19:27:26 borgdemon3 kernel: 1st 0xffffff0001674cf0 inp (udpinp) @ /usr/src/sys/netinet/in_mcast.c:670
Oct  3 19:27:26 borgdemon3 kernel: 2nd 0xffffffff8078e3c0 Giant (Giant) @ /usr/src/sys/netinet/in_mcast.c:317
Oct  3 19:27:26 borgdemon3 kernel: KDB: stack backtrace:
Oct  3 19:27:26 borgdemon3 kernel: db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
Oct  3 19:27:26 borgdemon3 kernel: witness_checkorder() at witness_checkorder+0x64b
Oct  3 19:27:26 borgdemon3 kernel: _mtx_lock_flags() at _mtx_lock_flags+0x75
Oct  3 19:27:26 borgdemon3 kernel: in_addmulti() at in_addmulti+0x1e3
Oct  3 19:27:26 borgdemon3 kernel: inp_setmoptions() at inp_setmoptions+0x111c
Oct  3 19:27:26 borgdemon3 kernel: ip_ctloutput() at ip_ctloutput+0x16f
Oct  3 19:27:26 borgdemon3 kernel: sosetopt() at sosetopt+0x3b
Oct  3 19:27:26 borgdemon3 kernel: kern_setsockopt() at kern_setsockopt+0xa2
Oct  3 19:27:26 borgdemon3 kernel: setsockopt() at setsockopt+0x22
Oct  3 19:27:26 borgdemon3 kernel: syscall() at syscall+0x1ca
Oct  3 19:27:26 borgdemon3 kernel: Xfast_syscall() at 
Oct  3 19:27:26 borgdemon3 kernel: Xfast_syscall+0xab
Oct  3 19:27:26 borgdemon3 kernel: --- syscall (105, FreeBSD ELF64, setsockopt), rip = 0x800eb8ebc, rsp = 0x7fffffffeb18, rbp = 0x7fffffffeb90 ---
--- lock-order-reversal ends here ---


>Release-Note:
>Audit-Trail:

From: Weongyo Jeong <weongyo.jeong@gmail.com>
To: John Merryweather Cooper <j.m.cooper@borgsdemons.com>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/116886: Lock Order Reversal on Current for kbd and zyd
Date: Mon, 8 Oct 2007 10:55:29 +0900

 On Wed, Oct 03, 2007 at 07:56:46PM -0700, John Merryweather Cooper wrote:
 > 
 > >Number:         116886
 > >Category:       kern
 > >Synopsis:       Lock Order Reversal on Current for kbd and zyd
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Thu Oct 04 05:20:03 GMT 2007
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     John Merryweather Cooper
 > >Release:        FreeBSD 7.0-CURRENT amd64
 > >Organization:
 > >Environment:
 > System: FreeBSD borgdemon3.temp.wsu.edu 7.0-CURRENT FreeBSD 7.0-CURRENT #8: Mon Oct 1 12:32:21 PDT 2007 root@borgdemon3.temp.wsu.edu:/usr/obj/usr/src/sys/TURION amd64
 > 
 > 
 > 	
 > >Description:
 > 	When the zyd0 interface first takes a DHCP IP (or when it roams),
 > 	it usually (but not always) throws the attach lock order reversal.
 > 	Rarely, the machine will lock up as a result.
 > >How-To-Repeat:
 > 	When interface takes a DHCP IP address or roams.
 > >Fix:
 > 
 > 	unknown
 > 
 > --- lock-order-reversal begins here ---
 > Oct  3 19:27:26 borgdemon3 kernel: lock order reversal: (Giant after non-sleepable)
 > Oct  3 19:27:26 borgdemon3 kernel: 1st 0xffffff0001674cf0 inp (udpinp) @ /usr/src/sys/netinet/in_mcast.c:670
 > Oct  3 19:27:26 borgdemon3 kernel: 2nd 0xffffffff8078e3c0 Giant (Giant) @ /usr/src/sys/netinet/in_mcast.c:317
 > Oct  3 19:27:26 borgdemon3 kernel: KDB: stack backtrace:
 > Oct  3 19:27:26 borgdemon3 kernel: db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
 > Oct  3 19:27:26 borgdemon3 kernel: witness_checkorder() at witness_checkorder+0x64b
 > Oct  3 19:27:26 borgdemon3 kernel: _mtx_lock_flags() at _mtx_lock_flags+0x75
 > Oct  3 19:27:26 borgdemon3 kernel: in_addmulti() at in_addmulti+0x1e3
 > Oct  3 19:27:26 borgdemon3 kernel: inp_setmoptions() at inp_setmoptions+0x111c
 > Oct  3 19:27:26 borgdemon3 kernel: ip_ctloutput() at ip_ctloutput+0x16f
 > Oct  3 19:27:26 borgdemon3 kernel: sosetopt() at sosetopt+0x3b
 > Oct  3 19:27:26 borgdemon3 kernel: kern_setsockopt() at kern_setsockopt+0xa2
 > Oct  3 19:27:26 borgdemon3 kernel: setsockopt() at setsockopt+0x22
 > Oct  3 19:27:26 borgdemon3 kernel: syscall() at syscall+0x1ca
 > Oct  3 19:27:26 borgdemon3 kernel: Xfast_syscall() at 
 > Oct  3 19:27:26 borgdemon3 kernel: Xfast_syscall+0xab
 > Oct  3 19:27:26 borgdemon3 kernel: --- syscall (105, FreeBSD ELF64, setsockopt), rip = 0x800eb8ebc, rsp = 0x7fffffffeb18, rbp = 0x7fffffffeb90 ---
 > --- lock-order-reversal ends here ---
 
 It seems that this LOR isn't occured in the zyd module only when I review
 the LOR message you sent.
 
 LOR is happened in in_addmulti().
 
 Regards,
 Weongyo Jeong

From: John Merryweather Cooper <j.m.cooper@borgsdemons.com>
To: Weongyo Jeong <weongyo.jeong@gmail.com>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/116886: Lock Order Reversal on Current for kbd and zyd
Date: Tue, 09 Oct 2007 10:17:45 -0700

 Weongyo Jeong wrote:
 > On Wed, Oct 03, 2007 at 07:56:46PM -0700, John Merryweather Cooper wrote:
 >   
 >>> Number:         116886
 >>> Category:       kern
 >>> Synopsis:       Lock Order Reversal on Current for kbd and zyd
 >>> Confidential:   no
 >>> Severity:       non-critical
 >>> Priority:       low
 >>> Responsible:    freebsd-bugs
 >>> State:          open
 >>> Quarter:        
 >>> Keywords:       
 >>> Date-Required:
 >>> Class:          sw-bug
 >>> Submitter-Id:   current-users
 >>> Arrival-Date:   Thu Oct 04 05:20:03 GMT 2007
 >>> Closed-Date:
 >>> Last-Modified:
 >>> Originator:     John Merryweather Cooper
 >>> Release:        FreeBSD 7.0-CURRENT amd64
 >>> Organization:
 >>> Environment:
 >>>       
 >> System: FreeBSD borgdemon3.temp.wsu.edu 7.0-CURRENT FreeBSD 7.0-CURRENT #8: Mon Oct 1 12:32:21 PDT 2007 root@borgdemon3.temp.wsu.edu:/usr/obj/usr/src/sys/TURION amd64
 >>
 >>
 >> 	
 >>     
 >>> Description:
 >>>       
 >> 	When the zyd0 interface first takes a DHCP IP (or when it roams),
 >> 	it usually (but not always) throws the attach lock order reversal.
 >> 	Rarely, the machine will lock up as a result.
 >>     
 >>> How-To-Repeat:
 >>>       
 >> 	When interface takes a DHCP IP address or roams.
 >>     
 >>> Fix:
 >>>       
 >> 	unknown
 >>
 >> --- lock-order-reversal begins here ---
 >> Oct  3 19:27:26 borgdemon3 kernel: lock order reversal: (Giant after non-sleepable)
 >> Oct  3 19:27:26 borgdemon3 kernel: 1st 0xffffff0001674cf0 inp (udpinp) @ /usr/src/sys/netinet/in_mcast.c:670
 >> Oct  3 19:27:26 borgdemon3 kernel: 2nd 0xffffffff8078e3c0 Giant (Giant) @ /usr/src/sys/netinet/in_mcast.c:317
 >> Oct  3 19:27:26 borgdemon3 kernel: KDB: stack backtrace:
 >> Oct  3 19:27:26 borgdemon3 kernel: db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
 >> Oct  3 19:27:26 borgdemon3 kernel: witness_checkorder() at witness_checkorder+0x64b
 >> Oct  3 19:27:26 borgdemon3 kernel: _mtx_lock_flags() at _mtx_lock_flags+0x75
 >> Oct  3 19:27:26 borgdemon3 kernel: in_addmulti() at in_addmulti+0x1e3
 >> Oct  3 19:27:26 borgdemon3 kernel: inp_setmoptions() at inp_setmoptions+0x111c
 >> Oct  3 19:27:26 borgdemon3 kernel: ip_ctloutput() at ip_ctloutput+0x16f
 >> Oct  3 19:27:26 borgdemon3 kernel: sosetopt() at sosetopt+0x3b
 >> Oct  3 19:27:26 borgdemon3 kernel: kern_setsockopt() at kern_setsockopt+0xa2
 >> Oct  3 19:27:26 borgdemon3 kernel: setsockopt() at setsockopt+0x22
 >> Oct  3 19:27:26 borgdemon3 kernel: syscall() at syscall+0x1ca
 >> Oct  3 19:27:26 borgdemon3 kernel: Xfast_syscall() at 
 >> Oct  3 19:27:26 borgdemon3 kernel: Xfast_syscall+0xab
 >> Oct  3 19:27:26 borgdemon3 kernel: --- syscall (105, FreeBSD ELF64, setsockopt), rip = 0x800eb8ebc, rsp = 0x7fffffffeb18, rbp = 0x7fffffffeb90 ---
 >> --- lock-order-reversal ends here ---
 >>     
 >
 > It seems that this LOR isn't occured in the zyd module only when I review
 > the LOR message you sent.
 >
 > LOR is happened in in_addmulti().
 >
 > Regards,
 > Weongyo Jeong
 Hmm, yes, it looks like the multicast code is the culprit.
 
 jmc
 
 

From: John Merryweather Cooper <john_m_cooper@yahoo.com>
To: bug-followup@FreeBSD.org, j.m.cooper@borgsdemons.com
Cc:  
Subject: kern/116886: Lock Order Reversal on Current for kbd and zyd
Date: Mon, 19 Nov 2007 11:43:45 -0800 (PST)

 This PR should be consolidated with 117150.
 
 jmc
 
 
Responsible-Changed-From-To: freebsd-bugs->weongyo 
Responsible-Changed-By: weongyo 
Responsible-Changed-When: Wed Jan 9 06:25:21 UTC 2008 
Responsible-Changed-Why:  
Grab this PR. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=116886 
State-Changed-From-To: open->closed 
State-Changed-By: weongyo 
State-Changed-When: Fri May 23 05:09:56 UTC 2008 
State-Changed-Why:  
This PR is solved. 


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