From hmo@sep.oldach.net  Fri Apr 10 07:33:38 2009
Return-Path: <hmo@sep.oldach.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8D69F10656ED;
	Fri, 10 Apr 2009 07:33:38 +0000 (UTC)
	(envelope-from hmo@sep.oldach.net)
Received: from rigel.oldach.net (rigel.oldach.net [194.8.96.250])
	by mx1.freebsd.org (Postfix) with ESMTP id 237148FC08;
	Fri, 10 Apr 2009 07:33:37 +0000 (UTC)
	(envelope-from hmo@sep.oldach.net)
Received: from sep.oldach.net (hmo.in-dsl.de [217.197.85.210])
	by rigel.oldach.net (8.14.3/8.14.3/hmo30jul04) with ESMTP id n3A7NSEB077896
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Fri, 10 Apr 2009 09:23:29 +0200 (CEST)
	(envelope-from hmo@sep.oldach.net)
Received: from sep.oldach.net (localhost [127.0.0.1])
	by sep.oldach.net (8.14.3/8.14.3/hmo26jun05) with ESMTP id n3A7NQ3i003585
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 10 Apr 2009 09:23:26 +0200 (CEST)
	(envelope-from hmo@sep.oldach.net)
Received: (from hmo@localhost)
	by sep.oldach.net (8.14.3/8.14.3/Submit/hmo26jun05) id n3A7NQ6P003584;
	Fri, 10 Apr 2009 09:23:26 +0200 (CEST)
	(envelope-from hmo)
Message-Id: <200904100723.n3A7NQ6P003584@sep.oldach.net>
Date: Fri, 10 Apr 2009 09:23:26 +0200 (CEST)
From: Helge Oldach <netinet-ip-output-apr09@oldach.net>
Reply-To: Helge Oldach <netinet-ip-output-apr09@oldach.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: obrien@freebsd.org, rwatson@freebsd.org
Subject: panic in sys/netinet/ip_output.c after r190369
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         133561
>Category:       kern
>Synopsis:       panic in sys/netinet/ip_output.c after r190369
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 10 07:40:00 UTC 2009
>Closed-Date:    Fri Apr 10 16:44:42 UTC 2009
>Last-Modified:  Fri Apr 10 17:00:11 UTC 2009
>Originator:     Helge Oldach
>Release:        FreeBSD 6.4-1439 i386
>Organization:
>Environment:

System: FreeBSD localhost 6.4-1439 FreeBSD 6.4-1439 #1: Fri Apr 10 08:55:22 CEST 2009 root@localhost:/usr/obj/usr/src/sys/HMO i386

This is a recent RELENG_6 system. In particular, SVN r190369 (from
obrien, reviewed by rwatson) is applied.

>Description:

System panic:

	Sleeping thread (tid 100071, pid 1003) owns a non-sleepable lock
	panic: sleeping thread

After some fiddling I discovered that this may be related to IPSEC. The
box does not crash with IPSEC disabled.

After browsing through the changes I inspected the code in
sys/netinet/ip_output.c. SVN r190369 did add three lines to lock/unlock
pcbinfo at apparently appropriate places.

I think the last two additions (case IP_IPSEC_POLICY in
ip_ctloutput_pcbinfo()) are just wrong. IMHO there is no need to lock
pcbinfo as we do not need INP_LOCK(inp) here.

Please also note that INP_INFO_WUNLOCK only happens *within* the if
clause, but not if the if clause is not met, so the pbcinfo is kept
locked, which is likely not intended.

Anyway, I decided to remove the two additional lines. Testing showed
that my box did not crash any longer (of course with IPSEC enabled).

>How-To-Repeat:

>Fix:

--- sys/netinet/ip_output.c.ctm	2009-03-24 22:24:19.000000000 +0100
+++ sys/netinet/ip_output.c	2009-04-10 08:52:12.000000000 +0200
@@ -1369,9 +1369,7 @@
 			req = mtod(m, caddr_t);
 			len = m->m_len;
 			optname = sopt->sopt_name;
-			INP_INFO_WLOCK(pcbinfo);
 			if (so->so_pcb == NULL) {
-				INP_INFO_WUNLOCK(pcbinfo);
 				m_free(m);
 				error = EINVAL;
 				break;


>Release-Note:
>Audit-Trail:

From: Mikolaj Golub <to.my.trociny@gmail.com>
To: Helge Oldach <netinet-ip-output-apr09@oldach.net>
Cc: FreeBSD-gnats-submit@FreeBSD.org,  rwatson@FreeBSD.org, obrien@FreeBSD.org, bug-followup@FreeBSD.org
Subject: Re: kern/133561: panic in sys/netinet/ip_output.c after r190369
Date: Fri, 10 Apr 2009 11:10:55 +0300

 This problem has already been reported in kern/133415 and kern/133445
 
 -- 
 Mikolaj Golub

From: Mikolaj Golub <to.my.trociny@gmail.com>
To: Helge Oldach <netinet-ip-output-apr09@oldach.net>
Cc: FreeBSD-gnats-submit@FreeBSD.org,  rwatson@FreeBSD.org, obrien@FreeBSD.org, bug-followup@FreeBSD.org
Subject: Re: kern/133561: panic in sys/netinet/ip_output.c after r190369
Date: Fri, 10 Apr 2009 11:10:55 +0300

 This problem has already been reported in kern/133415 and kern/133445
 
 -- 
 Mikolaj Golub
State-Changed-From-To: open->closed 
State-Changed-By: bz 
State-Changed-When: Fri Apr 10 16:43:30 UTC 2009 
State-Changed-Why:  
A fix has already been comitted: 
http://svn.freebsd.org/changeset/base/190890 


Responsible-Changed-From-To: freebsd-bugs->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Fri Apr 10 16:43:30 UTC 2009 
Responsible-Changed-Why:  
Track possible follow-ups. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133561 

From: netinet-ip-output-apr09@oldach.net (Helge Oldach)
To: bz@freebsd.org
Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Subject: Re: kern/133561: panic in sys/netinet/ip_output.c after r190369
Date: Fri, 10 Apr 2009 18:40:41 +0200 (CEST)

 Bjrn,
 
 please close this PR as well. Same bug as the ip_output fix committed
 this morning (kern/133415 and kern/133445). I should have waited just 4
 hours longer before raising this PR. :-)
 
 Helge
 
 
 FreeBSD-gnats-submit@FreeBSD.org wrote on Fri, 10 Apr 2009 09:40:00 +0200 (CEST):
 > Thank you very much for your problem report.
 > It has the internal identification `kern/133561'.
 > The individual assigned to look at your
 > report is: freebsd-bugs. 
 > 
 > You can access the state of your problem report at any time
 > via this link:
 > 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=133561
 > 
 > >Category:       kern
 > >Responsible:    freebsd-bugs
 > >Synopsis:       panic in sys/netinet/ip_output.c after r190369
 > >Arrival-Date:   Fri Apr 10 07:40:00 UTC 2009
 > 
 
>Unformatted:
