From nobody@FreeBSD.org  Sun Nov 10 03:30:36 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id B54E5C12
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 10 Nov 2013 03:30:36 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id A3ABC2369
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 10 Nov 2013 03:30:36 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rAA3UaJo009777
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 10 Nov 2013 03:30:36 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rAA3UaPJ009749;
	Sun, 10 Nov 2013 03:30:36 GMT
	(envelope-from nobody)
Message-Id: <201311100330.rAA3UaPJ009749@oldred.freebsd.org>
Date: Sun, 10 Nov 2013 03:30:36 GMT
From: Eric Lakin <elakin@infohell.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Kernel panic with VIMAGE on insertion of axe USB network interface
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         183835
>Category:       kern
>Synopsis:       Kernel panic with VIMAGE on insertion of axe USB network interface
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-virtualization
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 10 03:40:00 UTC 2013
>Closed-Date:    Sun Apr 20 02:12:03 UTC 2014
>Last-Modified:  Sun Apr 20 02:12:03 UTC 2014
>Originator:     Eric Lakin
>Release:        10.0-BETA3
>Organization:
>Environment:
FreeBSD sliver 10.0-BETA3 FreeBSD 10.0-BETA3 #2: Thu Nov  7 23:47:40 PST 2013     root@sliver:/usr/obj/usr/src/sys/SLIVER  amd64

>Description:
After adding

options VIMAGE

to the GENERIC kernel, system will panic immediately on insertion of an axe-base USB ethernet devices. Three different ones (two Linksys models and an apple) all produce the same result. Loading if_axe kld by itself does not cause a panic.
>How-To-Repeat:
Add 'options VIMAGE' to a kernel, and insert an axe-based USB ethernet device.
>Fix:


>Release-Note:
>Audit-Trail:

From: =?ISO-2022-JP?B?GyRCPi5MbjQyQDgbKEI=?= <hiroo.ono@gmail.com>
To: bug-followup@FreeBSD.org, elakin@infohell.net
Cc:  
Subject: Re: kern/183835: Kernel panic with VIMAGE on insertion of axe USB
 network interface
Date: Wed, 22 Jan 2014 17:15:09 +0900

 --001a11339e2e30630504f08ab9f3
 Content-Type: text/plain; charset=ISO-8859-1
 
 Hello,
 
 I have encountered the same problem
 
 Fatal trap 12: page fault while in kernel mode
 cpuid = 0; apic id = 01
 fault virtual address	= 0x18
 fault code		= supervisor read, page not present
 instruction pointer	= 0x20:0xc0a166d1
 stack pointer		= 0x28:0xf0527c18
 frame pointer		= 0x28:0xf0527c3c
 code segment		= base 0x0, limit 0xfffff, type 0x1b
 			= DPL 0, pres 1, def32 1, gran 1
 processor eflags	= interrupt enabled, resume, IOPL = 0
 current process		= 15 (axe0)
 [ thread pid 15 tid 100098 ]
 Stopped at	0xc0a166d1 = if_alloc+0xd1:	movl	0x18(%eax),%eax
 db> bt
 Tracing pid 15 tid 100098 td 0xc0c13c40
 if_alloc(6,c6bd5580,0,cb,0,...) at 0xc0a166d1 = if_alloc+0xd1/frame 0xf0527c3c
 ue_attach_post_task(c6bd54ac,20,c0e05d52,73,0,...) at 0xc713814e =
 ue_attach_post_task+0x8e/frame 0xf0527c94
 usb_process(c6bd5420,f0527d08,28219a3f,281eaa20,28223508,...) at
 0xc07fc4c1 = usb_process+0x131/frame 0xf0527cc4
 fork_exit(c07fc390,c6bd5420,f0527d08) at 0xc091fcc3 =
 fork_exit+0xa3/frame 0xf0527cf4
 fork_trampoline() at 0xc0ce78c4 = fork_trampoline+0x8/frame 0xf0527cf4
 
 it seems the page fault occurs at sys/net/if.c line 280 in ifindex_alloc_locked,
 when accessing V_if_index.
 
 looking at if_var.h and vnet.h, V_if_index will be
 
 1) when VIMAGE is not defined,
  V_if_index => VNET(if_index) => (if_index)
 
 2) when VIMAGE is defined,
  V_if_index => VNET(if_index)
   => VNET_VNET(curvnet, if_index)
   => (*VNET_VNET_PTR((curvnet), if_index))
   => _VNET_PTR((curvnet)->vnet_data_base, if_index)
   => (__typeof(VNET_NAME(if_index))*) (((curvnet)->vnet_data_base) +
 (uintptr_t)&VNET_NAME(if_index))
   => (__typeof(vnet_entry_if_index)*) (((curvnet)->vnet_data_base) +
 (uintptr_t)&vnet_entry_if_index)
 
 and something is wrong in 2). I have not detailed further.
 
 --001a11339e2e30630504f08ab9f3
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 Hello,<br><br>I have encountered the same problem<br><br><pre style=3D"colo=
 r:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;lette=
 r-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-t=
 ransform:none;word-spacing:0px;word-wrap:break-word;white-space:pre-wrap">
 Fatal trap 12: page fault while in kernel mode
 cpuid =3D 0; apic id =3D 01
 fault virtual address	=3D 0x18
 fault code		=3D supervisor read, page not present
 instruction pointer	=3D 0x20:0xc0a166d1
 stack pointer		=3D 0x28:0xf0527c18
 frame pointer		=3D 0x28:0xf0527c3c
 code segment		=3D base 0x0, limit 0xfffff, type 0x1b
 			=3D DPL 0, pres 1, def32 1, gran 1
 processor eflags	=3D interrupt enabled, resume, IOPL =3D 0
 current process		=3D 15 (axe0)
 [ thread pid 15 tid 100098 ]
 Stopped at	0xc0a166d1 =3D if_alloc+0xd1:	movl	0x18(%eax),%eax
 db&gt; bt
 Tracing pid 15 tid 100098 td 0xc0c13c40
 if_alloc(6,c6bd5580,0,cb,0,...) at 0xc0a166d1 =3D if_alloc+0xd1/frame 0xf05=
 27c3c
 ue_attach_post_task(c6bd54ac,20,c0e05d52,73,0,...) at 0xc713814e =3D ue_att=
 ach_post_task+0x8e/frame 0xf0527c94
 usb_process(c6bd5420,f0527d08,28219a3f,281eaa20,28223508,...) at 0xc07fc4c1=
  =3D usb_process+0x131/frame 0xf0527cc4
 fork_exit(c07fc390,c6bd5420,f0527d08) at 0xc091fcc3 =3D fork_exit+0xa3/fram=
 e 0xf0527cf4
 fork_trampoline() at 0xc0ce78c4 =3D fork_trampoline+0x8/frame 0xf0527cf4<br=
 ><br>it seems the page fault occurs at sys/net/if.c line 280 in ifindex_all=
 oc_locked,<br>when accessing V_if_index.<br><br>looking at if_var.h and vne=
 t.h, V_if_index will be<br>
 <br>1) when VIMAGE is not defined,<br> V_if_index =3D&gt; VNET(if_index) =
 =3D&gt; (if_index)<br><br>2) when VIMAGE is defined,<br> V_if_index =3D&gt;=
  VNET(if_index)<br> =A0=3D&gt; VNET_VNET(curvnet, if_index)<br> =A0=3D&gt; =
 (*VNET_VNET_PTR((curvnet), if_index))<br>
   =3D&gt; _VNET_PTR((curvnet)-&gt;vnet_data_base, if_index)<br>  =3D&gt; (_=
 _typeof(VNET_NAME(if_index))*) (((curvnet)-&gt;vnet_data_base) + (uintptr_t=
 )&amp;VNET_NAME(if_index))<br>  =3D&gt; (__typeof(vnet_entry_if_index)*) ((=
 (curvnet)-&gt;vnet_data_base) + (uintptr_t)&amp;vnet_entry_if_index)<br>
 <br>and something is wrong in 2). I have not detailed further.<br></pre>
 
 --001a11339e2e30630504f08ab9f3--

From: =?ISO-2022-JP?B?GyRCPi5MbjQyQDgbKEI=?= <hiroo.ono@gmail.com>
To: bug-followup@FreeBSD.org, elakin@infohell.net
Cc:  
Subject: Re: kern/183835: Kernel panic with VIMAGE on insertion of axe USB
 network interface
Date: Sun, 2 Feb 2014 01:37:35 +0900

 --089e01183fb8665ffc04f15ae81e
 Content-Type: text/plain; charset=ISO-8859-1
 
 Attached patch for src/sys/net/if.c makes if_axe work with VIMAGE.
 Though I do not understand well why it works...
 
 curvnet is allocated in src/sys/net/vnet.c:vnet0_init() and then
 substituted to NULL in vnet.c:vnet_init_done()
 I guess that devices that are persistent are if_alloc()'ed in between
 the two functions are called,
 but if_alloc() for removable devices like if_axe occurs after vnet_init_done().
 (if is is right, creating vnet first and plugging the device in may
 not cause the kernel panic, but I did not test this idea.)
 
 Moreover, with this patch, error messages below occur when destroying
 epair device, so it does not seem to be the proper solution.
 
 Freed UMA keg (udp_inpcb) was not empty (128 items). Lost 8 pages of memory.
 Freed UMA keg (udpcb) was not empty (252 items). Lost 1 pages of memory.
 Freed UMA keg (tcp_inpcb) was not empty (128 items). Lost 8 pages of memory.
 Freed UMA keg (tcpcb) was not empty (30 items). Lost 6 pages of memory.
 hhook_vnet_uninit: hhook_head type=1, id=1 cleanup required
 hhook_vnet_uninit: hhook_head type=1, id=0 cleanup required
 
 --089e01183fb8665ffc04f15ae81e
 Content-Type: text/plain; charset=US-ASCII; name="if.c.diff"
 Content-Disposition: attachment; filename="if.c.diff"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_hr536wm70
 
 LS0tIGlmLmMub3JpZwkyMDE0LTAxLTIxIDAyOjEwOjU5LjAwMDAwMDAwMCArMDkwMAorKysgaWYu
 YwkyMDE0LTAxLTMwIDAwOjA0OjAxLjAwMDAwMDAwMCArMDkwMApAQCAtNDMyLDYgKzQzMiwxMCBA
 QAogCXVfc2hvcnQgaWR4OwogCiAJaWZwID0gbWFsbG9jKHNpemVvZihzdHJ1Y3QgaWZuZXQpLCBN
 X0lGTkVULCBNX1dBSVRPS3xNX1pFUk8pOworI2lmZGVmIFZJTUFHRQorCWlmIChjdXJ2bmV0ID09
 IE5VTEwpCisJCWN1cnZuZXQgPSB2bmV0MDsKKyNlbmRpZgogCUlGTkVUX1dMT0NLKCk7CiAJaWYg
 KGlmaW5kZXhfYWxsb2NfbG9ja2VkKCZpZHgpICE9IDApIHsKIAkJSUZORVRfV1VOTE9DSygpOwo=
 --089e01183fb8665ffc04f15ae81e--

From: =?ISO-2022-JP?B?SGlyb28gT25vICgbJEI+LkxuGyhCIBskQjQyQDgbKEIp?= <hiroo.ono@gmail.com>
To: bug-followup@FreeBSD.org, elakin@infohell.net
Cc:  
Subject: kern/183835: Kernel panic with VIMAGE on insertion of axe USB network interface
Date: Sun, 16 Feb 2014 19:10:16 +0900

 --bcaec51d2eb8e55f9804f2833e21
 Content-Type: text/plain; charset=ISO-8859-1
 
 Hello,
 
 Attached patch to sys/dev/usb/usb_ethernet.c should solve the problem
 of VIMAGE and USB ether.
 The problem occur when ue_attach_post_task() (in
 sys/dev/usb/net/usb_ethernet.c) is called.
 
 ue_attach_post_task() calls if_alloc() (in sys/net/if.c) and
 ether_attach() (in sys/net/if_ethersubr.c), which
 finally refer V_if_index. The backtrace is as follows.
 
 Fatal trap 12: page fault while in kernel mode
 cpuid = 1; apic id = 01
 fault virtual address	= 0x18
 fault code		= supervisor read, page not present
 instruction pointer	= 0x20:0xc0b8eae1
 stack pointer	        = 0x28:0xe8fafc18
 frame pointer	        = 0x28:0xe8fafc3c
 code segment		= base 0x0, limit 0xfffff, type 0x1b
 			= DPL 0, pres 1, def32 1, gran 1
 processor eflags	= interrupt enabled, resume, IOPL = 0
 current process		= 15 (axe0)
 Uptime: 2m53s
 Physical memory: 991 MB
 Dumping 64 MB: 49 33 17 1
 
 Reading symbols from /boot/kernel/if_axe.ko.symbols...done.
 Loaded symbols for /boot/kernel/if_axe.ko.symbols
 Reading symbols from /boot/kernel/uether.ko.symbols...done.
 Loaded symbols for /boot/kernel/uether.ko.symbols
 #0  doadump (textdump=1) at pcpu.h:233
 	in pcpu.h
 (kgdb) bt
 #0  doadump (textdump=1) at pcpu.h:233
 #1  0xc0aca740 in kern_reboot (howto=260)
     at /usr/src/sys/kern/kern_shutdown.c:447
 #2  0xc0acab1f in panic (fmt=<value optimized out>)
     at /usr/src/sys/kern/kern_shutdown.c:754
 #3  0xc0524225 in db_panic (addr=-1061623071, have_addr=0, count=-1,
     modif=0xe8faf894 "") at /usr/src/sys/ddb/db_command.c:482
 #4  0xc0523e57 in db_command (cmd_table=<value optimized out>)
     at /usr/src/sys/ddb/db_command.c:449
 #5  0xc0523b70 in db_command_loop () at /usr/src/sys/ddb/db_command.c:502
 #6  0xc05263b0 in db_trap (type=<value optimized out>, code=744908288)
     at /usr/src/sys/ddb/db_main.c:231
 #7  0xc0b05738 in kdb_trap (type=<value optimized out>,
     code=<value optimized out>, tf=<value optimized out>)
     at /usr/src/sys/kern/subr_kdb.c:656
 #8  0xc0fc11ba in trap_fatal (frame=0xe8fafbd8, eva=24)
     at /usr/src/sys/i386/i386/trap.c:1038
 #9  0xc0fc152d in trap_pfault (frame=0x0, usermode=<value optimized out>,
     eva=0) at /usr/src/sys/i386/i386/trap.c:859
 #10 0xc0fc0b09 in trap (frame=0xe8fafbd8) at /usr/src/sys/i386/i386/trap.c:556
 #11 0xc0faa62c in calltrap () at /usr/src/sys/i386/i386/exception.s:170
 #12 0xc0b8eae1 in if_alloc (type=<value optimized out>)
     at /usr/src/sys/net/if.c:280
 #13 0xc64b614e in ue_attach_post_task (_task=0xc5d1faac)
     at /usr/src/sys/modules/usb/uether/../../../dev/usb/net/usb_ethernet.c:210
 #14 0xc095d1c1 in usb_process (arg=0xc5d1fa20)
     at /usr/src/sys/dev/usb/usb_process.c:177
 #15 0xc0a984b3 in fork_exit (callout=0xc095d090 <usb_process>)
     at /usr/src/sys/kern/kern_fork.c:995
 #16 0xc0faa6d4 in fork_trampoline () at /usr/src/sys/i386/i386/exception.s:279
 
 
 The problem is that curvnet is NULL when ue_attach_post_task()
 is invoked, and with VIMAGE, V_if_index is defined to
 	VNET(if_index)	=> VNET_VNET(curvnet, if_index)
 			=> (*VNET_VNET_PTR((curvnet), if_index))
 			=> (*_VNET_PTR((curvnet)->vnet_data_base, if_index))
 	and so on.
 
 For device attachment, the following code device_probe_and_attach()
 (in kern/subr_bus.c)
 
 	CURVNET_SET_QUIET(vnet0);
 	error = device_attach(dev);
 	CURVNET_RESTORE();
 
 should assign curvnet to vnet0, but it is not the case for ue device.
 As an example of USB ethernet device, with if_axe, device_attach(dev)
 is axe_attach() (in sys/dev/usb/net/if_axe.c).
 axe_attach() calls uether_ifattach() (in sys/dev/usb/net/usb_ethernet.c)
 (other USB ethernet devices' *_attach() also calls this function),
 which *queues* (not calls) ue_attach_post_task.
 As ue_attach_post_task is called from usb_process (not from uther_ifattach),
 it is not assured that curvnet is properly assigned.
 
 --bcaec51d2eb8e55f9804f2833e21
 Content-Type: text/plain; charset=US-ASCII; name="usb_ethernet.c.diff"
 Content-Disposition: attachment; filename="usb_ethernet.c.diff"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_hrq5ia9d0
 
 LS0tIHVzYl9ldGhlcm5ldC5jLm9yaWcJMjAxNC0wMi0xNiAyMDowODozMi4wMDAwMDAwMDAgKzA5
 MDAKKysrIHVzYl9ldGhlcm5ldC5jCTIwMTQtMDItMTYgMjA6MTM6MjcuMDAwMDAwMDAwICswOTAw
 CkBAIC00Nyw2ICs0Nyw3IEBACiAjaW5jbHVkZSA8bmV0L2lmX3R5cGVzLmg+CiAjaW5jbHVkZSA8
 bmV0L2lmX21lZGlhLmg+CiAjaW5jbHVkZSA8bmV0L2lmX3ZsYW5fdmFyLmg+CisjaW5jbHVkZSA8
 bmV0L3ZuZXQuaD4KIAogI2luY2x1ZGUgPGRldi9taWkvbWlpLmg+CiAjaW5jbHVkZSA8ZGV2L21p
 aS9taWl2YXIuaD4KQEAgLTIwNiw2ICsyMDcsNyBAQAogCXVzYl9jYWxsb3V0X2luaXRfbXR4KCZ1
 ZS0+dWVfd2F0Y2hkb2csIHVlLT51ZV9tdHgsIDApOwogCXN5c2N0bF9jdHhfaW5pdCgmdWUtPnVl
 X3N5c2N0bF9jdHgpOwogCisJQ1VSVk5FVF9TRVRfUVVJRVQodm5ldDApOwogCWVycm9yID0gMDsK
 IAlpZnAgPSBpZl9hbGxvYyhJRlRfRVRIRVIpOwogCWlmIChpZnAgPT0gTlVMTCkgewpAQCAtMjUz
 LDYgKzI1NSw4IEBACiAJaWYgKGlmcC0+aWZfY2FwYWJpbGl0aWVzICYgSUZDQVBfVkxBTl9NVFUp
 CiAJCWlmcC0+aWZfaGRybGVuID0gc2l6ZW9mKHN0cnVjdCBldGhlcl92bGFuX2hlYWRlcik7CiAK
 KwlDVVJWTkVUX1JFU1RPUkUoKTsKKwogCXNucHJpbnRmKG51bSwgc2l6ZW9mKG51bSksICIldSIs
 IHVlLT51ZV91bml0KTsKIAl1ZS0+dWVfc3lzY3RsX29pZCA9IFNZU0NUTF9BRERfTk9ERSgmdWUt
 PnVlX3N5c2N0bF9jdHgsCiAJICAgICZTWVNDVExfTk9ERV9DSElMRFJFTihfbmV0LCB1ZSksCg==
 --bcaec51d2eb8e55f9804f2833e21--

From: =?ISO-2022-JP?B?SGlyb28gT25vICgbJEI+LkxuGyhCIBskQjQyQDgbKEIp?= <hiroo.ono@gmail.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: kern/183835: Kernel panic with VIMAGE on insertion of axe USB
 network interface
Date: Sun, 16 Feb 2014 23:02:07 +0900

 --089e01633aa81104d704f2867c6d
 Content-Type: text/plain; charset=ISO-8859-1
 
 Please replace the previous patch. I forgot CURVNET_RESTORE() in the fail case.
 
 --089e01633aa81104d704f2867c6d
 Content-Type: text/plain; charset=US-ASCII; name="usb_ethernet.c.diff"
 Content-Disposition: attachment; filename="usb_ethernet.c.diff"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_hrqdue0e1
 
 LS0tIHVzYl9ldGhlcm5ldC5jLm9yaWcJMjAxNC0wMi0xNiAyMDowODozMi4wMDAwMDAwMDAgKzA5
 MDAKKysrIHVzYl9ldGhlcm5ldC5jCTIwMTQtMDItMTcgMDc6NDE6MDkuMDAwMDAwMDAwICswOTAw
 CkBAIC00Nyw2ICs0Nyw3IEBACiAjaW5jbHVkZSA8bmV0L2lmX3R5cGVzLmg+CiAjaW5jbHVkZSA8
 bmV0L2lmX21lZGlhLmg+CiAjaW5jbHVkZSA8bmV0L2lmX3ZsYW5fdmFyLmg+CisjaW5jbHVkZSA8
 bmV0L3ZuZXQuaD4KIAogI2luY2x1ZGUgPGRldi9taWkvbWlpLmg+CiAjaW5jbHVkZSA8ZGV2L21p
 aS9taWl2YXIuaD4KQEAgLTIwNiw2ICsyMDcsNyBAQAogCXVzYl9jYWxsb3V0X2luaXRfbXR4KCZ1
 ZS0+dWVfd2F0Y2hkb2csIHVlLT51ZV9tdHgsIDApOwogCXN5c2N0bF9jdHhfaW5pdCgmdWUtPnVl
 X3N5c2N0bF9jdHgpOwogCisJQ1VSVk5FVF9TRVRfUVVJRVQodm5ldDApOwogCWVycm9yID0gMDsK
 IAlpZnAgPSBpZl9hbGxvYyhJRlRfRVRIRVIpOwogCWlmIChpZnAgPT0gTlVMTCkgewpAQCAtMjUz
 LDYgKzI1NSw4IEBACiAJaWYgKGlmcC0+aWZfY2FwYWJpbGl0aWVzICYgSUZDQVBfVkxBTl9NVFUp
 CiAJCWlmcC0+aWZfaGRybGVuID0gc2l6ZW9mKHN0cnVjdCBldGhlcl92bGFuX2hlYWRlcik7CiAK
 KwlDVVJWTkVUX1JFU1RPUkUoKTsKKwogCXNucHJpbnRmKG51bSwgc2l6ZW9mKG51bSksICIldSIs
 IHVlLT51ZV91bml0KTsKIAl1ZS0+dWVfc3lzY3RsX29pZCA9IFNZU0NUTF9BRERfTk9ERSgmdWUt
 PnVlX3N5c2N0bF9jdHgsCiAJICAgICZTWVNDVExfTk9ERV9DSElMRFJFTihfbmV0LCB1ZSksCkBA
 IC0yNjYsNiArMjcwLDcgQEAKIAlyZXR1cm47CiAKIGZhaWw6CisJQ1VSVk5FVF9SRVNUT1JFKCk7
 CiAJZnJlZV91bnIodWV1bml0LCB1ZS0+dWVfdW5pdCk7CiAJaWYgKHVlLT51ZV9pZnAgIT0gTlVM
 TCkgewogCQlpZl9mcmVlKHVlLT51ZV9pZnApOwo=
 --089e01633aa81104d704f2867c6d--
Responsible-Changed-From-To: freebsd-bugs->freebsd-virtualization 
Responsible-Changed-By: rodrigc 
Responsible-Changed-When: Sun Feb 16 18:07:56 PST 2014 
Responsible-Changed-Why:  
Throwing in with other VIMAGE bugs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=183835 
State-Changed-From-To: open->patched 
State-Changed-By: rodrigc 
State-Changed-When: Mon Feb 17 17:24:11 PST 2014 
State-Changed-Why:  
Patched. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/183835: commit references a PR
Date: Tue, 18 Feb 2014 01:20:34 +0000 (UTC)

 Author: rodrigc
 Date: Tue Feb 18 01:20:26 2014
 New Revision: 262142
 URL: http://svnweb.freebsd.org/changeset/base/262142
 
 Log:
   In ue_attach_post_task(), initialize curvnet to vnet0 before calling if_attach().
   Before this patch, curvnet was NULL.
   When the VIMAGE kernel option is enabled, this eliminates
   kernel panics when USB ethernet devices are plugged in.
   
   PR: 183835
   Submitted by: Hiroo Oono <hiroo.ono at gmail dot com>
 
 Modified:
   head/sys/dev/usb/net/usb_ethernet.c
 
 Modified: head/sys/dev/usb/net/usb_ethernet.c
 ==============================================================================
 --- head/sys/dev/usb/net/usb_ethernet.c	Tue Feb 18 01:15:32 2014	(r262141)
 +++ head/sys/dev/usb/net/usb_ethernet.c	Tue Feb 18 01:20:26 2014	(r262142)
 @@ -208,6 +208,7 @@ ue_attach_post_task(struct usb_proc_msg 
  	sysctl_ctx_init(&ue->ue_sysctl_ctx);
  
  	error = 0;
 +	CURVNET_SET_QUIET(vnet0);
  	ifp = if_alloc(IFT_ETHER);
  	if (ifp == NULL) {
  		device_printf(ue->ue_dev, "could not allocate ifnet\n");
 @@ -254,6 +255,8 @@ ue_attach_post_task(struct usb_proc_msg 
  	if (ifp->if_capabilities & IFCAP_VLAN_MTU)
  		ifp->if_hdrlen = sizeof(struct ether_vlan_header);
  
 +	CURVNET_RESTORE();
 +
  	snprintf(num, sizeof(num), "%u", ue->ue_unit);
  	ue->ue_sysctl_oid = SYSCTL_ADD_NODE(&ue->ue_sysctl_ctx,
  	    &SYSCTL_NODE_CHILDREN(_net, ue),
 @@ -267,6 +270,7 @@ ue_attach_post_task(struct usb_proc_msg 
  	return;
  
  fail:
 +	CURVNET_RESTORE();
  	free_unr(ueunit, ue->ue_unit);
  	if (ue->ue_ifp != NULL) {
  		if_free(ue->ue_ifp);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/183835: commit references a PR
Date: Mon, 24 Feb 2014 08:50:19 +0000 (UTC)

 Author: rodrigc
 Date: Mon Feb 24 08:50:06 2014
 New Revision: 262436
 URL: http://svnweb.freebsd.org/changeset/base/262436
 
 Log:
   MFC r262142:
   
      In ue_attach_post_task(), initialize curvnet to vnet0 before calling if_attach().
      Before this patch, curvnet was NULL.
      When the VIMAGE kernel option is enabled, this eliminates
      kernel panics when USB ethernet devices are plugged in.
   
   PR: 183835
   Submitted by: Hiroo Oono <hiroo.ono at gmail dot com>
 
 Modified:
   stable/10/sys/dev/usb/net/usb_ethernet.c
 Directory Properties:
   stable/10/   (props changed)
 
 Modified: stable/10/sys/dev/usb/net/usb_ethernet.c
 ==============================================================================
 --- stable/10/sys/dev/usb/net/usb_ethernet.c	Mon Feb 24 08:21:49 2014	(r262435)
 +++ stable/10/sys/dev/usb/net/usb_ethernet.c	Mon Feb 24 08:50:06 2014	(r262436)
 @@ -207,6 +207,7 @@ ue_attach_post_task(struct usb_proc_msg 
  	sysctl_ctx_init(&ue->ue_sysctl_ctx);
  
  	error = 0;
 +	CURVNET_SET_QUIET(vnet0);
  	ifp = if_alloc(IFT_ETHER);
  	if (ifp == NULL) {
  		device_printf(ue->ue_dev, "could not allocate ifnet\n");
 @@ -253,6 +254,8 @@ ue_attach_post_task(struct usb_proc_msg 
  	if (ifp->if_capabilities & IFCAP_VLAN_MTU)
  		ifp->if_hdrlen = sizeof(struct ether_vlan_header);
  
 +	CURVNET_RESTORE();
 +
  	snprintf(num, sizeof(num), "%u", ue->ue_unit);
  	ue->ue_sysctl_oid = SYSCTL_ADD_NODE(&ue->ue_sysctl_ctx,
  	    &SYSCTL_NODE_CHILDREN(_net, ue),
 @@ -266,6 +269,7 @@ ue_attach_post_task(struct usb_proc_msg 
  	return;
  
  fail:
 +	CURVNET_RESTORE();
  	free_unr(ueunit, ue->ue_unit);
  	if (ue->ue_ifp != NULL) {
  		if_free(ue->ue_ifp);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/183835: commit references a PR
Date: Fri, 28 Feb 2014 01:35:31 +0000 (UTC)

 Author: rodrigc
 Date: Fri Feb 28 01:35:24 2014
 New Revision: 262594
 URL: http://svnweb.freebsd.org/changeset/base/262594
 
 Log:
   MFC r262142:
   
      In ue_attach_post_task(), initialize curvnet to vnet0 before calling if_attach().
      Before this patch, curvnet was NULL.
      When the VIMAGE kernel option is enabled, this eliminates
      kernel panics when USB ethernet devices are plugged in.
   
   PR: 183835
   Submitted by: Hiroo Oono <hiroo.ono at gmail dot com>
 
 Modified:
   stable/9/sys/dev/usb/net/usb_ethernet.c
 Directory Properties:
   stable/9/   (props changed)
 
 Modified: stable/9/sys/dev/usb/net/usb_ethernet.c
 ==============================================================================
 --- stable/9/sys/dev/usb/net/usb_ethernet.c	Fri Feb 28 01:33:03 2014	(r262593)
 +++ stable/9/sys/dev/usb/net/usb_ethernet.c	Fri Feb 28 01:35:24 2014	(r262594)
 @@ -207,6 +207,7 @@ ue_attach_post_task(struct usb_proc_msg 
  	sysctl_ctx_init(&ue->ue_sysctl_ctx);
  
  	error = 0;
 +	CURVNET_SET_QUIET(vnet0);
  	ifp = if_alloc(IFT_ETHER);
  	if (ifp == NULL) {
  		device_printf(ue->ue_dev, "could not allocate ifnet\n");
 @@ -254,6 +255,8 @@ ue_attach_post_task(struct usb_proc_msg 
  	if (ifp->if_capabilities & IFCAP_VLAN_MTU)
  		ifp->if_hdrlen = sizeof(struct ether_vlan_header);
  
 +	CURVNET_RESTORE();
 +
  	snprintf(num, sizeof(num), "%u", ue->ue_unit);
  	ue->ue_sysctl_oid = SYSCTL_ADD_NODE(&ue->ue_sysctl_ctx,
  	    &SYSCTL_NODE_CHILDREN(_net, ue),
 @@ -267,6 +270,7 @@ ue_attach_post_task(struct usb_proc_msg 
  	return;
  
  fail:
 +	CURVNET_RESTORE();
  	free_unr(ueunit, ue->ue_unit);
  	if (ue->ue_ifp != NULL) {
  		if_free(ue->ue_ifp);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: linimon 
State-Changed-When: Sun Apr 20 01:48:45 UTC 2014 
State-Changed-Why:  
MFCed to appropriate branches. 


Responsible-Changed-From-To: freebsd-virtualization->freebsd-virtualization 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Apr 20 01:48:45 UTC 2014 
Responsible-Changed-Why:  

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