From nobody@FreeBSD.org  Mon Aug  8 23:57:23 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 12B7F16A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  8 Aug 2005 23:57:23 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B81B843D6D
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  8 Aug 2005 23:57:16 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j78NvFK4057329
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 8 Aug 2005 23:57:15 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j78NvFOS057320;
	Mon, 8 Aug 2005 23:57:15 GMT
	(envelope-from nobody)
Message-Id: <200508082357.j78NvFOS057320@www.freebsd.org>
Date: Mon, 8 Aug 2005 23:57:15 GMT
From: Vladimir <bobahu4@mail.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: kernel panic with if_ppp
X-Send-Pr-Version: www-2.3

>Number:         84686
>Category:       kern
>Synopsis:       [patch] kernel panic with if_ppp
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 09 00:00:32 GMT 2005
>Closed-Date:    Fri Sep 02 14:55:28 GMT 2005
>Last-Modified:  Fri Sep 02 14:55:28 GMT 2005
>Originator:     Vladimir
>Release:        6.0 beta1
>Organization:
none
>Environment:
cann't say, now in linux. GENERIC kernel. no some recompilation
>Description:
It's kernel panic, when i use ppp connection
from kdb i know it:
NIC: _mtx_lock_sleep:recursed on non-recursed mutex ppp_softc_list_mtx @ /usr/src/sys/net/if_ppp.c:168

cpuid=0
KDB enter:panic
[threaded pid 35 tid 100017]

stopped at
kdb_enter+0x2b:nop


i use umodem.ko and ucom.ko for my usb modem(motorolla c350)
pppd is 2.6.13.
>How-To-Repeat:
it's emergent, when i use my connection, via pppd call some_peer
>Fix:
      
>Release-Note:
>Audit-Trail:

From: Gleb Smirnoff <glebius@FreeBSD.org>
To: Vladimir <bobahu4@mail.ru>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/84686: kernel panic with if_ppp
Date: Tue, 9 Aug 2005 13:26:38 +0400

 V> It's kernel panic, when i use ppp connection
 V> from kdb i know it:
 V> NIC: _mtx_lock_sleep:recursed on non-recursed mutex ppp_softc_list_mtx @ /usr/src/sys/net/if_ppp.c:168
 
 Can you take a backtrace? Type 'trace' in kgdb.
 
 -- 
 Totus tuus, Glebius.
 GLEBIUS-RIPN GLEB-RIPE

From: bobahu4 <bobahu4@mail.ru>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/84686: kernel panic with if_ppp
Date: Tue, 09 Aug 2005 17:05:37 +0500

 Ok, i done it.
 
 db>trace
 
 tracing pid 35 tid 100017 d 0xc19d2900
 
 kdb_enter(c0854b84) at kdb_enter+0x2b
 
 panic(c0854034, c085ef71, c085ef3c, a8, c096ce20) at panic+0x127
 
 _mtx_lock_cleep(c096ce20, c19d2900, 0, c085ef3c, a8) at _mtx_lock_sleep+0x36
 
 _mtx_lock_flags(c096ce20, 0, c085ef3c, a8, c1c0c400) at _mtx_lock_flags+0x85
 
 ppp_for_tty(c1c0c400, c22a5800, c1c0438, d44c2cbc, c06a0fce) at 
 ppp_for_tty+0x1e
 
 pppstart(c1c0c400) at pppstart+0xe
 
 pppasyncstart(c22a5800) at pppasyncstart + 0x31e
 
 pppintr(0) at pppintr+0x68
 
 swi_net(0) at swi_net+0x7d
 
 ithread_loop(c1a11580, d44c2d38, c1a11580, c061f5f0, 0) at 
 ithread_loop+0x11c
 
 fork_exit(c061f5f0, c1a11580, d44c2d38) at fork_exit+0xa0
 
 fork_trampoline() at fork_trampoline+0x8
 
 --- trap 0x1, eip=0, esp=0xd44c2d6c, ebp=0 ---
 
 db>print
 
 c0649803
 
 
 

From: 8084 <bobahu4@mail.ru>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/84686: kernel panic with if_ppp
Date: Tue, 9 Aug 2005 17:08:53 +0500

 Ok, i done it.
 
 db>trace
 
 tracing pid 35 tid 100017 d 0xc19d2900
 
 kdb_enter(c0854b84) at kdb_enter+0x2b
 
 panic(c0854034, c085ef71, c085ef3c, a8, c096ce20) at panic+0x127
 
 _mtx_lock_cleep(c096ce20, c19d2900, 0, c085ef3c, a8) at _mtx_lock_sleep+0x36
 
 _mtx_lock_flags(c096ce20, 0, c085ef3c, a8, c1c0c400) at _mtx_lock_flags+0x85
 
 ppp_for_tty(c1c0c400, c22a5800, c1c0438, d44c2cbc, c06a0fce) at ppp_for_tty+0x1e
 
 pppstart(c1c0c400) at pppstart+0xe
 
 pppasyncstart(c22a5800) at pppasyncstart + 0x31e
 
 pppintr(0) at pppintr+0x68
 
 swi_net(0) at swi_net+0x7d
 
 ithread_loop(c1a11580, d44c2d38, c1a11580, c061f5f0, 0) at ithread_loop+0x11c
 
 fork_exit(c061f5f0, c1a11580, d44c2d38) at fork_exit+0xa0
 
 fork_trampoline() at fork_trampoline+0x8
 
 --- trap 0x1, eip=0, esp=0xd44c2d6c, ebp=0 ---
 
 db>print
 
 c0649803
 
 

From: 8084 <bobahu4@mail.ru>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/84686: kernel panic with if_ppp
Date: Tue, 9 Aug 2005 17:16:17 +0500

 and i have mistaken with pppd version
 pppd version is 2.3.13
 p.s.     )

From: Gleb Smirnoff <glebius@FreeBSD.org>
To: Vladimir <bobahu4@mail.ru>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/84686: kernel panic with if_ppp
Date: Thu, 11 Aug 2005 15:08:20 +0400

 --/e2eDi0V/xtL+Mc8
 Content-Type: text/plain; charset=koi8-r
 Content-Disposition: inline
 
   Can you please try out this patch.
 
 -- 
 Totus tuus, Glebius.
 GLEBIUS-RIPN GLEB-RIPE
 
 --/e2eDi0V/xtL+Mc8
 Content-Type: text/plain; charset=koi8-r
 Content-Disposition: attachment; filename="ppp.diff"
 
 Index: if_ppp.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/if_ppp.c,v
 retrieving revision 1.106
 diff -u -r1.106 if_ppp.c
 --- if_ppp.c	9 Aug 2005 10:19:58 -0000	1.106
 +++ if_ppp.c	11 Aug 2005 11:01:19 -0000
 @@ -160,22 +160,6 @@
  static int	ppp_clone_create(struct if_clone *, int);
  static void	ppp_clone_destroy(struct ifnet *);
  
 -struct ppp_softc *
 -ppp_for_tty(struct tty *tp)
 -{
 -	struct ppp_softc *sc;
 -
 -	PPP_LIST_LOCK();
 -	LIST_FOREACH(sc, &ppp_softc_list, sc_list) {
 -		if (sc->sc_devp == (void*)tp) {
 -			PPP_LIST_UNLOCK();
 -			return (sc);
 -		}
 -	}
 -	PPP_LIST_UNLOCK();
 -	return (NULL);
 -}
 -
  IFC_SIMPLE_DECLARE(ppp, 0);
  
  /*
 Index: if_pppvar.h
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/if_pppvar.h,v
 retrieving revision 1.23
 diff -u -r1.23 if_pppvar.h
 --- if_pppvar.h	10 Jun 2005 16:49:18 -0000	1.23
 +++ if_pppvar.h	11 Aug 2005 11:01:37 -0000
 @@ -110,4 +110,3 @@
  void	ppp_restart(struct ppp_softc *sc);
  void	ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost);
  struct	mbuf *ppp_dequeue(struct ppp_softc *sc);
 -struct	ppp_softc *ppp_for_tty(struct tty *);
 Index: ppp_tty.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/ppp_tty.c,v
 retrieving revision 1.67
 diff -u -r1.67 ppp_tty.c
 --- ppp_tty.c	9 Aug 2005 10:19:58 -0000	1.67
 +++ ppp_tty.c	11 Aug 2005 11:03:33 -0000
 @@ -212,6 +212,7 @@
      PPP2IFP(sc)->if_baudrate = tp->t_ospeed;
  
      tp->t_hotchar = PPP_FLAG;
 +    tp->t_lsc = sc;
      ttyflush(tp, FREAD | FWRITE);
  
      /*
 @@ -240,14 +241,13 @@
      struct tty *tp;
      int flag;
  {
 -    register struct ppp_softc *sc;
 +    register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
      int s;
  
      s = spltty();
      ttyflush(tp, FREAD | FWRITE);
      clist_free_cblocks(&tp->t_canq);
      clist_free_cblocks(&tp->t_outq);
 -    sc = ppp_for_tty(tp);
      if (sc != NULL) {
  	    pppasyncrelinq(sc);
  	    pppdealloc(sc);
 @@ -309,7 +309,7 @@
      struct uio *uio;
      int flag;
  {
 -    register struct ppp_softc *sc = ppp_for_tty(tp);
 +    register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
      struct mbuf *m, *m0;
      register int s;
      int error = 0;
 @@ -368,7 +368,7 @@
      struct uio *uio;
      int flag;
  {
 -    register struct ppp_softc *sc = ppp_for_tty(tp);
 +    register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
      struct mbuf *m;
      struct sockaddr dst;
      int error, s;
 @@ -414,7 +414,7 @@
      int flag;
      struct thread *td;
  {
 -    struct ppp_softc *sc = ppp_for_tty(tp);
 +    struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
      int error, s;
  
      if (sc == NULL || tp != (struct tty *) sc->sc_devp)
 @@ -729,7 +729,7 @@
  pppstart(tp)
      register struct tty *tp;
  {
 -    register struct ppp_softc *sc = ppp_for_tty(tp);
 +    register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
  
      /*
       * Call output process whether or not there is any output.
 @@ -815,7 +815,7 @@
      struct mbuf *m;
      int ilen, s;
  
 -    sc = ppp_for_tty(tp);
 +    sc = (struct ppp_softc *)tp->t_lsc;
      if (sc == NULL)
  	return 0;
  
 
 --/e2eDi0V/xtL+Mc8--
State-Changed-From-To: open->patched 
State-Changed-By: glebius 
State-Changed-When: Fri Aug 12 08:27:19 GMT 2005 
State-Changed-Why:  
Fixed in HEAD. 


Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Fri Aug 12 08:27:19 GMT 2005 
Responsible-Changed-Why:  
Take it. 

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

Adding to audit trail from misfiled PR kern/84825: the original submitter
says that this fixed the problem.
State-Changed-From-To: patched->closed 
State-Changed-By: glebius 
State-Changed-When: Fri Sep 2 14:55:11 GMT 2005 
State-Changed-Why:  
Merged to RELENG_6. 

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