Re: [patch] VirtualBox-4.0.14 + FreeBSD/CURRENT + VIMAGE: crash on vm shutdown

2012-04-01 Thread Mikolaj Golub
Hi,

On Fri, 30 Mar 2012 10:13:57 +0200 Bernhard Froehlich wrote:

 BF> Sorry for the late response and thanks for the patch. Is this patch
 BF> still required for 4.1.8? My guess is yes but it would be great if you
 BF> could confirm that with the latest port.

Sorry, it required some time to check -- I upgraded my box to the latest
current and had some instabilities to fix before testing vbox.

So on the recent current and VirtualBox-4.1.10 (the latest version I have
found in the ports) the VBoxNetFlt patch is still required but VBoxNetAdp also
needs patching: I had a crash on vm start:

#0  doadump (textdump=-2022600704) at pcpu.h:244
#1  0x8051af69 in db_fncall (dummy1=1, dummy2=0, dummy3=-2127583648, 
dummy4=0xdcb61838 "")
at /home/golub/freebsd/base/head/sys/ddb/db_command.c:573
#2  0x8051b361 in db_command (last_cmdp=0x811221fc, cmd_table=0x0, dopager=1)
at /home/golub/freebsd/base/head/sys/ddb/db_command.c:449
#3  0x8051b4ba in db_command_loop () at 
/home/golub/freebsd/base/head/sys/ddb/db_command.c:502
#4  0x8051d4ad in db_trap (type=12, code=0)
at /home/golub/freebsd/base/head/sys/ddb/db_main.c:229
#5  0x80a81d96 in kdb_trap (type=12, code=0, tf=0xdcb61ad4)
at /home/golub/freebsd/base/head/sys/kern/subr_kdb.c:629
#6  0x80dd22af in trap_fatal (frame=0xdcb61ad4, eva=24)
at /home/golub/freebsd/base/head/sys/i386/i386/trap.c:1014
#7  0x80dd2387 in trap_pfault (frame=0xdcb61ad4, usermode=0, eva=24)
at /home/golub/freebsd/base/head/sys/i386/i386/trap.c:835
#8  0x80dd3451 in trap (frame=0xdcb61ad4)
at /home/golub/freebsd/base/head/sys/i386/i386/trap.c:547
#9  0x80dbccac in calltrap () at 
/home/golub/freebsd/base/head/sys/i386/i386/exception.s:169
#10 0x80b0633e in ifindex_alloc_locked (idxp=0xdcb61b56)
at /home/golub/freebsd/base/head/sys/net/if.c:279
#11 0x80b09172 in if_alloc (type=6 '\006') at 
/home/golub/freebsd/base/head/sys/net/if.c:435
#12 0x8b01e8e7 in vboxNetAdpOsCreate () from /boot/modules/vboxnetadp.ko
#13 0x8b01ef00 in vboxNetAdpCreate () from /boot/modules/vboxnetadp.ko
#14 0x8b01ecd8 in VBoxNetAdpFreeBSDCtrlioctl () from /boot/modules/vboxnetadp.ko
#15 0x8095c6bb in devfs_ioctl_f (fp=0x8b6f8118, com=3223352833, 
data=0x8b022360, 
cred=0x87759b00, td=0x89fdf2e0)
at /home/golub/freebsd/base/head/sys/fs/devfs/devfs_vnops.c:757
#16 0x80a9b4ed in kern_ioctl (td=0x89fdf2e0, fd=3, com=3223352833, 
data=0x8b022360 "vboxnet0")
at file.h:287
#17 0x80a9b674 in sys_ioctl (td=0x89fdf2e0, uap=0xdcb61cec)
at /home/golub/freebsd/base/head/sys/kern/sys_generic.c:691
#18 0x80dd29ae in syscall (frame=0xdcb61d28) at subr_syscall.c:135

I am attaching two patches: the first one is for VBoxNetFlt (the same I sent
to the list but against 4.1.10) and the second one for VBoxNetAdp (a fix for
the panic above).

 BF> Do you aggree that this patch is under MIT License so that I can push
 BF> it upstream?

Sure for both patches. Thanks for taking it!

-- 
Mikolaj Golub

diff -rpu VirtualBox-4.1.10.orig/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c VirtualBox-4.1.10/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
--- VirtualBox-4.1.10.orig/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c	2012-03-13 15:15:44.0 +0200
+++ VirtualBox-4.1.10/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c	2012-04-01 13:43:02.0 +0300
@@ -651,13 +651,13 @@ bool vboxNetFltOsMaybeRediscovered(PVBOX
 ng_rmnode_self(pThis->u.s.node);
 pThis->u.s.node = NULL;
 }
+VBOXCURVNET_RESTORE();
 
 if (ifp0 != NULL)
 {
 vboxNetFltOsDeleteInstance(pThis);
 vboxNetFltOsInitInstance(pThis, NULL);
 }
-VBOXCURVNET_RESTORE();
 
 return !ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost);
 }
@@ -671,8 +671,10 @@ void vboxNetFltOsDeleteInstance(PVBOXNET
 mtx_destroy(&pThis->u.s.inq.ifq_mtx);
 mtx_destroy(&pThis->u.s.outq.ifq_mtx);
 
+VBOXCURVNET_SET_FROM_UCRED();
 if (pThis->u.s.node != NULL)
 ng_rmnode_self(pThis->u.s.node);
+VBOXCURVNET_RESTORE();
 pThis->u.s.node = NULL;
 }
diff -rpu VirtualBox-4.1.10.orig/src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile VirtualBox-4.1.10/src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile
--- VirtualBox-4.1.10.orig/src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile	2012-03-13 15:15:44.0 +0200
+++ VirtualBox-4.1.10/src/VBox/HostDrivers/VBoxNetAdp/freebsd/Makefile	2012-04-01 13:27:16.0 +0300
@@ -18,7 +18,7 @@
 
 KMOD = vboxnetadp
 
-CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING
+CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -Iinclude -I. -Ir0drv -w -DVBOX_WITH_HARDENING -DVIMAGE
 
 .if (${MACHINE_ARCH} == "i386")
  CFLAGS += -DRT_ARCH_X86
diff -rpu VirtualBox-4.1.10.orig/src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c VirtualBox-4.1.10/src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxN

Re: [patch] VirtualBox-4.0.14 + FreeBSD/CURRENT + VIMAGE: crash on vm shutdown

2012-03-30 Thread Bernhard Froehlich

On 19.03.2012 20:48, Mikolaj Golub wrote:

Hi,

Here is a patch that fixes the issue I have been observing recently: 
running

on VIMAGE enabled kernel VirtualBox causes the kernel crash when vm
is powered
off:

ng_unref_node(8b156880,0,1,101,0,...) at ng_unref_node+0x74
ng_snd_item(8d060d40,0,8b0e18f0,0,0,...) at ng_snd_item+0x2a5
ng_send_fn(8b156880,0,8b0e18f0,0,0,...) at ng_send_fn+0x35
ng_rmnode_self(8b156880,89f840e0,8b0dbcc0,deec88cc,8b0d9ffa,...) at
ng_rmnode_self+0x4a

vboxNetFltOsDeleteInstance(89f84010,89f84014,89f84010,deec88ec,8b0da0f4,...)
at vboxNetFltOsDeleteInstance+0x63
vboxNetFltRelease(89f84010,0,0,0,89f84014,...) at 
vboxNetFltRelease+0x6a


vboxNetFltPortDisconnectAndRelease(89f84014,2710,87748bd4,87748bd4,deec8930,...)
at vboxNetFltPortDisconnectAndRelease+0x64
_end(8b15ed10,89f84210,877456b0,0,deec8990,...) at 0x8cffe057
SUPR0ObjRelease(8b15ed10,89f4b810,deec89c8,deec89a0,0,...) at
SUPR0ObjRelease+0x133
_end(8b15eb90,898a0e10,877456b0,0,89f4b810,...) at 0x8cffe4bb

supdrvCleanupSession(8162bac0,89f4b810,89f4b810,deec89f4,8160e52f,...)
at supdrvCleanupSession+0xef
supdrvCloseSession(8162bac0,89f4b810,8ceecb18,deec8a18,8ceecaa0,...)
at supdrvCloseSession+0x19
VBoxDrvFreeBSDClose(89ee6c00,3,2000,8adcc5c0,8adcc5c0,...) at
VBoxDrvFreeBSDClose+0x2f
devfs_close(deec8a78,8ceecaa0,80400,80f8caac,133,...) at 
devfs_close+0x2ca
VOP_CLOSE_APV(81095960,deec8a78,80f8caac,133,2,...) at 
VOP_CLOSE_APV+0xda

vn_close(8ceecaa0,3,8b24b380,8adcc5c0,80f792e0,...) at vn_close+0x190
vn_closefile(89f8cd58,8adcc5c0,0,89f8cd58,0,...) at vn_closefile+0xe4
devfs_close_f(89f8cd58,8adcc5c0,0,0,89f8cd58,...) at 
devfs_close_f+0x35


_fdrop(89f8cd58,8adcc5c0,0,deec8b80,0,8adcc670,81273398,810a7620,89e50c2c,79d,80f7401d,deec8b90,80a2f81e,89e50c2c,8,80f7401d,79d,0,89f8cd58)
at _fdrop+0x43
closef(89f8cd58,8adcc5c0,79d,79a,8adcc670,...) at closef+0x2b0
fdfree(8adcc5c0,0,80f74dc6,107,deec8c18,...) at fdfree+0x3ea
exit1(8adcc5c0,0,deec8d1c,80db7aee,8adcc5c0,...) at exit1+0x57a
sys_sys_exit(8adcc5c0,deec8cec,80fd0bf8,80f53607,8adbf5c0,...) at
sys_sys_exit+0x1d
syscall(deec8d28) at syscall+0x2de
Xint0x80_syscall() at Xint0x80_syscall+0x21


Sorry for the late response and thanks for the patch. Is this patch
still required for 4.1.8? My guess is yes but it would be great if you
could confirm that with the latest port.

Do you aggree that this patch is under MIT License so that I can push
it upstream?

--
Bernhard Froehlich
http://www.bluelife.at/
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: [patch] VirtualBox-4.0.14 + FreeBSD/CURRENT + VIMAGE: crash on vm shutdown

2012-03-20 Thread Mikolaj Golub

On Tue, 20 Mar 2012 09:24:46 +1100 Petro Rossini wrote:

 PR> On Tue, Mar 20, 2012 at 5:48 AM, Mikolaj Golub  wrote:
 >> Hi,
 >>
 >> Here is a patch that fixes the issue I have been observing recently: running
 >> on VIMAGE enabled kernel VirtualBox causes the kernel crash when vm is 
 >> powered
 >> off:
 >> ..

 PR> Hi Mikolaj and others,

 PR> is it considered "safe" to run VIMAGE+VirtualBox on -STABLE?

I have been running it on my laptop with CURRENT for more than a year and it
worked for me until recently and works now again with this patch.

 PR> I have one VirtualBox in my otherwise jail based infrastructure (to
 PR> run a Zimbra mail server under Ubuntu), and would like to move this
 PR> machine and the "standby" forward from FreeBSD-8 to -9, as well as
 PR> start to use VIMAGE here as I do on the other boxes.

 PR> Regards
 PR> Peter

-- 
Mikolaj Golub
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: [patch] VirtualBox-4.0.14 + FreeBSD/CURRENT + VIMAGE: crash on vm shutdown

2012-03-19 Thread Petro Rossini
On Tue, Mar 20, 2012 at 5:48 AM, Mikolaj Golub  wrote:
> Hi,
>
> Here is a patch that fixes the issue I have been observing recently: running
> on VIMAGE enabled kernel VirtualBox causes the kernel crash when vm is powered
> off:
> ..

Hi Mikolaj and others,

is it considered "safe" to run VIMAGE+VirtualBox on -STABLE?

I have one VirtualBox in my otherwise jail based infrastructure (to
run a Zimbra mail server under Ubuntu), and would like to move this
machine and the "standby" forward from FreeBSD-8 to -9, as well as
start to use VIMAGE here as I do on the other boxes.

Regards
Peter
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"