From stas@core.310.ru  Sun Jun 19 12:41:55 2005
Return-Path: <stas@core.310.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A859316A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 19 Jun 2005 12:41:55 +0000 (GMT)
	(envelope-from stas@core.310.ru)
Received: from core.310.ru (core.310.ru [83.97.105.75])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2F62A43D48
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 19 Jun 2005 12:41:54 +0000 (GMT)
	(envelope-from stas@core.310.ru)
Received: from core.310.ru (localhost [127.0.0.1])
	by core.310.ru (8.13.3/8.12.11) with ESMTP id j5JCBAvG097432
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 19 Jun 2005 16:11:10 +0400 (MSD)
	(envelope-from stas@core.310.ru)
Received: (from stas@localhost)
	by core.310.ru (8.13.3/8.12.11/Submit) id j5JCBAZk097431;
	Sun, 19 Jun 2005 16:11:10 +0400 (MSD)
	(envelope-from stas)
Message-Id: <200506191211.j5JCBAZk097431@core.310.ru>
Date: Sun, 19 Jun 2005 16:11:10 +0400 (MSD)
From: Stanislav Sedov <stas@310.ru>
Reply-To: Stanislav Sedov <stas@310.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Kernel panic in ksocket netgraph module
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         82413
>Category:       kern
>Synopsis:       Kernel panic in ksocket netgraph module
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 19 12:50:22 GMT 2005
>Closed-Date:    Fri Sep 09 06:19:10 GMT 2005
>Last-Modified:  Fri Sep 09 06:19:10 GMT 2005
>Originator:     Stanislav Sedov
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
310.ru [Tridesyatoe]
>Environment:
System: FreeBSD stalingrad.realnet 6.0-CURRENT FreeBSD 6.0-CURRENT #134: Sat Jun 18 14:21:40 MSD 2005 root@stalingrad.realnet:/work/src/fbsd-cur/src/sys/i386/compile/DESKTOP i386


	
>Description:
	When using ksocket netgraph module(in mpd pptp for example),
kernel panic occur. Other modules aren't affected.
>How-To-Repeat:
	For example, run mpd with following config and try to download some
data via its interface.
--- mpd.conf--
default:
        load vpn

vpn:
        new -i ng0 vpn vpn
        set iface disable on-demand
        set iface addrs 10.3.81.2
        set iface idle 0
        set iface route 192.168.1.1/0
        set bundle disable multilink
        set bundle authname "user"
        set bundle password "password"
        set link yes acfcomp protocomp
        set link no pap
        set link yes chap
        set link mtu 1460
        set link enable no-orig-auth
        set ipcp yes vjcomp
        set ccp yes mppc
        set ccp yes mpp-e40
        set ccp yes mpp-e128
        set bundle enable crypt-reqd
        set ccp yes mpp-stateless
        open

--------------
>Fix:

I'm not familar with netgraph code, so I can't figure out where is a problem.
However, when using non-queue function in ng_ksocket_incoming, everything
works well. It seems the problem in queue realization of ng_send_fn1
in ng_base.c or in ng_ksocket_incoming2.
----------------------------------------------------
--- ng_ksocket.c        Sun Jun 19 16:29:30 2005
+++ ng_ksocket.c.orig   Sun Jun 19 16:29:18 2005
@@ -1013,7 +1013,7 @@

        wait = (waitflag & M_WAITOK) ? NG_WAITOK : 0;
        ng_send_fn1(node, NULL, &ng_ksocket_incoming2, so, waitflag,
-           wait);
+           wait | NG_QUEUE);
 }
-------------------------------------------------------


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Mon Jun 20 09:03:46 GMT 2005 
Responsible-Changed-Why:  
Mine. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82413 
State-Changed-From-To: open->feedback 
State-Changed-By: glebius 
State-Changed-When: Mon Jun 20 09:04:05 GMT 2005 
State-Changed-Why:  
Can you please show us the panic message and backtrace? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82413 
State-Changed-From-To: feedback->analyzed 
State-Changed-By: glebius 
State-Changed-When: Thu Aug 25 07:21:15 GMT 2005 
State-Changed-Why:  
It seems that problem lives outside ng_ksocket, but the last change 
to ng_ksocket exposed it. It was backed out until I find the cause 
of the problem. 

Also note that PR kern/84952 is similar to this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82413 
State-Changed-From-To: analyzed->patched 
State-Changed-By: glebius 
State-Changed-When: Tue Sep 6 17:15:50 GMT 2005 
State-Changed-Why:  
Fixed in HEAD. You are encouranged to merge revision 1.57 of ng_ksocket.c 
into your kernel and report whether this fixes your problems. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82413 
State-Changed-From-To: patched->closed 
State-Changed-By: glebius 
State-Changed-When: Fri Sep 9 06:18:58 GMT 2005 
State-Changed-Why:  
Fixed in RELENG_[56]. 

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