Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jun 2012 09:31:17 GMT
From:      Thomas Eberhardt <sneakywumpus@googlemail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/169565: [patch] emulators/virtualbox-ose-kmod vboxnetadp kernel panic on unload
Message-ID:  <201206300931.q5U9VH21080555@red.freebsd.org>
Resent-Message-ID: <201206300940.q5U9eAqd085497@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         169565
>Category:       ports
>Synopsis:       [patch] emulators/virtualbox-ose-kmod vboxnetadp kernel panic on unload
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 30 09:40:10 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Eberhardt
>Release:        FreeBSD 9.0-STABLE amd64
>Organization:
>Environment:
FreeBSD clarence.ocp.lan 9.0-STABLE FreeBSD 9.0-STABLE #0 r237835M: Sat Jun 30 10:51:44 CEST 2012     thomas@clarence.ocp.lan:/usr/obj/usr/src/sys/CLARENCE  amd64
>Description:
I'm getting consistent kernel panics on unload of vboxnetadp. Started at around beginning of May 2012.
>How-To-Repeat:
kldload vboxnetadp
kldunload vboxnetadp

>Fix:
Looking at patch-src-VBox-HostDrivers-VBoxNetAdp-freebsd-VBoxNetAdp-freebsd.c in the port, i found something fishy:

@@ -286,7 +304,9 @@ void vboxNetAdpOsDestroy(PVBOXNETADP pTh
 {
     struct ifnet *ifp;
 
+    VBOXCURVNET_SET(ifp->if_vnet);
     ifp = pThis->u.s.ifp;
     ether_ifdetach(ifp);
     if_free(ifp);
+    VBOXCURVNET_RESTORE();
 }

looks like ifp is being used uninitialized. I changed this part of the patch to:

@@ -286,7 +304,8 @@ void vboxNetAdpOsDestroy(PVBOXNETADP pTh
 {
-    struct ifnet *ifp;
+    struct ifnet *ifp = pThis->u.s.ifp;

-    ifp = pThis->u.s.ifp;
+    VBOXCURVNET_SET(ifp->if_vnet);
     ether_ifdetach(ifp);
     if_free(ifp);
+    VBOXCURVNET_RESTORE();
 }

After this change the kernel panics stopped.


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206300931.q5U9VH21080555>