Re: VirtualBox + VIMAGE

2011-01-24 Thread Julian Elischer

On 1/23/11 6:33 AM, Mikolaj Golub wrote:

Hi,

Sorry for cross posting, but this question concerns both VirtualBox and VIMAGE 
:-).

I would like to be able to run VirtualBox on my desktop, with kernel compilled
with VIMAGE, so I would use light vnet jails for FreeBSD VMs and VirtualBox
for other OSes.

Currently the system will crash if you try to use VirtualBox bridged
networking under VIMAGE kernel.

The crash may look like below:

db  bt

Tracing pid 2349 tid 100239 td 0xc984b2d0
ifunit(c7e3b9ac,6f,c129e970,f8089984,c08d6dc0,...) at ifunit+0x33
vboxNetFltOsInitInstance(c7e3b810,0,8,7,c9aa6ae0,...) at 
vboxNetFltOsInitInstance+0x31
vboxNetFltFactoryCreateAndConnect(c9aa8cc8,c96636d4,c9664010,0,c966403c,...) at 
vboxNetFltFactory
CreateAndConnect+0x1f7
_end(c7b11810,c962c238,3,c962c2b8,0,...) at 0xc9c0114f
_end(c7b11810,c962c22c,f20,c0d31268,f8089a90,...) at 0xc9c01265
_end(c962c22c,0,0,c7b11810,c0cfe2fe,...) at 0xc9bbc775
_end(f808a000,fffd,28,c962c22c,0,...) at 0xc9bbd086
supdrvIOCtl(c10c5607,c12a0a40,c7b11810,c962c200,c0e81df8,...) at 
supdrvIOCtl+0x1af1
VBoxDrvFreeBSDIOCtl(c94efb00,c10c5607,c962c200,3,c984b2d0,...) at 
VBoxDrvFreeBSDIOCtl+0x1ea
devfs_ioctl_f(c8e70118,c10c5607,c962c200,c9a82900,c984b2d0,...) at 
devfs_ioctl_f+0x10b
kern_ioctl(c984b2d0,e,c10c5607,c962c200,1089cec,...) at kern_ioctl+0x1fd
ioctl(c984b2d0,f8089cec,2b077000,1,c94ed2a8,...) at ioctl+0x134
syscallenter(c984b2d0,f8089ce4,c0c20e2d,c0e83290,0,...) at syscallenter+0x2a6
syscall(f8089d28) at syscall+0x4f
Xint0x80_syscall() at Xint0x80_syscall+0x21
--- syscall (54, FreeBSD ELF32, ioctl), eip = 0x282ae093, esp = 0xbf8b980c, ebp 
= 0xbf8b9828 ---

So it crashes when a function (ifunit in this case) tries to access
virtualized variable (V_ifnet in this case). The macro uses td-td_vnet for
this, which should be set to current vnet, but for VBox driver threads it is
NULL.

As a quick fix I added in VBoxNetFlt-freebsd.c in all problem functions
CURVNET_SET_QUIET(vnet0) macro, which sets td-td_vnet to default vnet (see the
attached patch). This has fixed the issue for me and now I am happily running
both VNET jails and VirtualBox machines on my desktop.

But the way I fixed the issue looks hackish for me. Could someone suggest a
better solution?

this is probably at east partially the correct solution.
Usually you should also set the value back to its previous value when 
you leave that code as well.



In case someone is interested in trying this patch, below are the instructions
how to build VIMAGE safe vbox driver from ports:

cd /usr/ports/emulators/virtualbox-ose-kmod
make patch
cd work
patch -p0  /path/to/VirtualBox-3.2.12.VIMAGE.patch
cd ..
VIMAGE=1 make



___
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


___
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


Current problem reports assigned to freebsd-virtualization@FreeBSD.org

2011-01-24 Thread FreeBSD bugmaster
Note: to view an individual PR, use:
  http://www.freebsd.org/cgi/query-pr.cgi?pr=(number).

The following is a listing of current problems submitted by FreeBSD users.
These represent problem reports covering all versions including
experimental development code and obsolete releases.


S Tracker  Resp.  Description

a kern/152047  virtualization[vimage] [panic] TUN\TAP under jail with vimage 
crashe
o kern/148155  virtualization[vimage] Kernel panic with PF/IPFilter + VIMAGE 
kernel
a kern/147950  virtualization[vimage] [carp] VIMAGE + CARP = kernel crash
s kern/143808  virtualization[pf] pf does not work inside jail
a kern/141696  virtualization[rum] [panic] rum(4)+ vimage = kernel panic

5 problems total.

___
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