From nobody@FreeBSD.org  Mon Mar 22 07:53:29 2004
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 0C56B16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 Mar 2004 07:53:29 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0550C43D39
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 Mar 2004 07:53:29 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i2MFrS72071349
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 22 Mar 2004 07:53:28 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id i2MFrSgG071347;
	Mon, 22 Mar 2004 07:53:28 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200403221553.i2MFrSgG071347@www.freebsd.org>
Date: Mon, 22 Mar 2004 07:53:28 -0800 (PST)
From: Mike <mikef@zerompg.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: kernel panic when running ifconfig in perl to create vlans
X-Send-Pr-Version: www-2.3

>Number:         64572
>Category:       kern
>Synopsis:       [panic] kernel panic when running ifconfig in perl to create vlans
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    brooks
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 22 08:00:35 PST 2004
>Closed-Date:    Mon Sep 13 20:30:12 GMT 2004
>Last-Modified:  Mon Sep 13 20:30:12 GMT 2004
>Originator:     Mike
>Release:        5.2.1
>Organization:
None
>Environment:
FreeBSD hostname.blah.com 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Mon Feb 23 20:45:55 GMT 2004     root@wv1u.btc.adaptec.com:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
When creating vlans manually i get no kernel panic:
Works-> ifconfig vlan30 create vlan 30 vlandev fxp2 mtu 1500 up

But when i use a perl script to pull values from an array and run it I get a kernel panic.


>How-To-Repeat:
Use this Perl script:

#!/usr/bin/perl
@vlans=(
        "30,fxp2",
        "31,fxp2",
        "32,fxp2"
);

foreach (@vlans){
        ($vnum,$int)=(split "," ,$_)[0,1];
        print("Bringing up VLAN $vnum on $int\n");
        system("ifconfig vlan$vnum create vlan $vnum vlandev $int mtu 1500 up");
}

>Fix:
It looks like the problem is just bringing the interface up in perl
if I use: system("ifconfig vlan$vnum create vlan $vnum vlandev $int mtu 1500") it works but "ifconfig vlan$vnum up" is what causes the panic
>Release-Note:
>Audit-Trail:

From: mikef@zerompg.com
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: i386/64572: kernel panic when running ifconfig in perl to create 
     vlans
Date: Mon, 22 Mar 2004 13:33:28 -0500 (EST)

 The kernel panic also happens when running a bunch of ifconfig vlan inet
 adds from a shell script. It happens running them all with and without a 1
 second delay between commands. I've tested this on 2 seperate machines.
 Interfaces are Dual port eepro100's on a P4 2.4ghz box with 512MB ram and
 an Intel S845WD1-E motherboard with hyperthreading turned off if it helps.
 
 
Responsible-Changed-From-To: freebsd-i386->brooks 
Responsible-Changed-By: brooks 
Responsible-Changed-When: Fri Jul 23 16:52:59 GMT 2004 
Responsible-Changed-Why:  
I'll take this one, it's probably my bug. 

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

From: Brooks Davis <brooks@one-eyed-alien.net>
To: freebsd-gnats-submit@FreeBSD.org, mikef@zerompg.com
Cc:  
Subject: Re: i386/64572: [panic] kernel panic when running ifconfig in perl to create vlans
Date: Fri, 23 Jul 2004 09:57:23 -0700

 Can you verify that this occurs in 5-CURRENT?  Off the top of my head
 the problem could be a race in the cloning code or a race between
 cloning and first use.  If the former, it should be fixed since we now
 have locking around the cloning code.
 
 -- Brooks
State-Changed-From-To: open->feedback 
State-Changed-By: brooks 
State-Changed-When: Fri Jul 23 17:02:05 GMT 2004 
State-Changed-Why:  
Awaiting feedback. 

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

From: Brooks Davis <brooks@one-eyed-alien.net>
To: freebsd-gnats-submit@FreeBSD.org, mikef@zerompg.com
Cc:  
Subject: Re: kern/64572: [panic] kernel panic when running ifconfig in perl to create vlans
Date: Fri, 30 Jul 2004 16:44:13 -0700

 Hmm, I can't replicate this on a 5.2.1-RELEASE machine.  I'm using the
 following script which does about what your's does.  How fast is your
 machine?  Is it SMP?  The machine I've tested on so far is a PIII 600
 UP system so it's possiable there's a race I'm not hitting that you are
 if you've got a more modern machine.
 
 -- Brooks
 
 #!/bin/sh
 # Create and configure vlans 0-29
 for vlan in `jot 30 0`; do
         ifconfig vlan${vlan} create vlan $vlan vlandev fxp2 mtu 1500 up
 done
 

From: Brooks Davis <brooks@one-eyed-alien.net>
To: freebsd-gnats-submit@FreeBSD.org, mikef@zerompg.com
Cc:  
Subject: Re: kern/64572: [panic] kernel panic when running ifconfig in perl to create vlans
Date: Fri, 30 Jul 2004 16:55:02 -0700

 --fUYQa+Pmc3FrFX/N
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Fri, Jul 30, 2004 at 11:50:31PM +0000, Brooks Davis wrote:
 >  Hmm, I can't replicate this on a 5.2.1-RELEASE machine.  I'm using the
 >  following script which does about what your's does.  How fast is your
 >  machine?  Is it SMP?  The machine I've tested on so far is a PIII 600
 >  UP system so it's possiable there's a race I'm not hitting that you are
 >  if you've got a more modern machine.
 
 One more thing here.  I'm confident there are races in some of the
 attach code.  I don't know how we could be hitting them here since we're
 creating one interface at a time, but I do know they exist.  I'm working
 to fix them, but I suspect that's going to be messy.
 
 -- Brooks
 
 --=20
 Any statement of the form "X is the one, true Y" is FALSE.
 PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
 
 --fUYQa+Pmc3FrFX/N
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.1 (GNU/Linux)
 
 iD8DBQFBCt/VXY6L6fI4GtQRAnm1AKDhvqNa0E9yGtmVTMztYTJ/F0kXWQCgjvSw
 syiaCK49tB0vEjyPawX31Lk=
 =jQDx
 -----END PGP SIGNATURE-----
 
 --fUYQa+Pmc3FrFX/N--
State-Changed-From-To: feedback->closed 
State-Changed-By: brooks 
State-Changed-When: Mon Sep 13 20:27:55 GMT 2004 
State-Changed-Why:  
No feedback for a month and I can not reproduce this problem on a recent 
version.  While there could be a problem with certain configurations, I 
consider this solved for now. 

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