Subject: Re: [vserver] compiling vmplayer modules in a debian 2.6.18-amd64 vserver
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Mon, 5 Jan 2009 14:33:10 +0100

On Mon, Jan 05, 2009 at 12:16:54AM +0100, Ekkard Gerlach wrote:
> Hi, 
> I'm quite new here. I try to compile vmplayer-1.9 modules
> in a debian 2.6.18-amd64 vserver with name "vmplayer". Is 
> the error shown below caused by the vserver special?
> Is a vserver allowed to load modules to the kernel environment? 
> Perhaps the modules have to be loaded (and compiled) by the host?
> 
> 
> vmplayer:/home/install/vmware-player-distrib# ./vmware-install.pl 
> [...]
> Trying to find a suitable vmmon module for your running kernel.
> 
> None of the pre-built vmmon modules for VMware Player is suitable for your 
> running kernel.  Do you want this program to try to build the vmmon module for 
> your system (you need to have a C compiler installed on your system)? [yes] 
> 
> Using compiler "/usr/bin/gcc". Use environment variable CC to override.
> 
> What is the location of the directory of C header files that match your running
> kernel? 
> [/lib/modules/2.6.18-6-vserver-amd64/build/include] 
> 
> Extracting the sources of the vmmon module.
> 
> Building the vmmon module.
> 
> Using 2.6.x kernel build system.
> make: Entering directory `/tmp/vmware-config0/vmmon-only'
> make -C /lib/modules/2.6.18-6-vserver-amd64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/.
modules
> make[1]: Entering directory `/usr/src/linux-headers-2.6.18-6-vserver-amd64'
>   CC [M]  /tmp/vmware-config0/vmmon-only/linux/driver.o
>   CC [M]  /tmp/vmware-config0/vmmon-only/linux/hostif.o
>   CC [M]  /tmp/vmware-config0/vmmon-only/common/cpuid.o
>   CC [M]  /tmp/vmware-config0/vmmon-only/common/hash.o
>   CC [M]  /tmp/vmware-config0/vmmon-only/common/memtrack.o
>   CC [M]  /tmp/vmware-config0/vmmon-only/common/phystrack.o
>   CC [M]  /tmp/vmware-config0/vmmon-only/common/task.o
>   CC [M]  /tmp/vmware-config0/vmmon-only/common/vmx86.o
>   CC [M]  /tmp/vmware-config0/vmmon-only/vmcore/moduleloop.o
>   LD [M]  /tmp/vmware-config0/vmmon-only/vmmon.o
>   Building modules, stage 2.
>   MODPOST
>   CC      /tmp/vmware-config0/vmmon-only/vmmon.mod.o
>   LD [M]  /tmp/vmware-config0/vmmon-only/vmmon.ko
> make[1]: Leaving directory `/usr/src/linux-headers-2.6.18-6-vserver-amd64'
> cp -f vmmon.ko ./../vmmon.o
> make: Leaving directory `/tmp/vmware-config0/vmmon-only'
> Unable to make a vmmon module that can be loaded in the running kernel:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this is a misleading (wrong) message

> insmod: error inserting '/tmp/vmware-config0/vmmon.o': -1 
~~~~~~~~~~~~~~~~~~~~~~~~~ this is the real cause for the failure
> Operation not permitted
~~~~~~~~~~~~~~~~~~~~~~~~~ and this is for a good reason :)

> There is probably a slight difference in the kernel configuration
> between the set of C header files you specified and your running
> kernel. You may want to rebuild a kernel based on that directory, or
> specify another directory.

so, as expected (and you already guessed) a guest is not
allowed to load a kernel module, otherwise it would be
quite easy for a guest to hijack the kernel ...

try loading the module on the host, and do not forget to
provide the device nodes (interface to userspace) to the
guest .. also note that this is a potential backdoor to
the kernel (not worse than vmware on a non Linux-VServer
machine though), and you might want to consider using
kvm instead of the vmware player

HTH,
Herbert

> For more information on how to troubleshoot module-related problems, please 
> visit our Web site at "http://www.vmware.com/download/modules/modules.html" and
> "http://www.vmware.com/support/reference/linux/prebuilt_modules_linux.html".
> 
> Execution aborted.
> 
> vmplayer:/home/install/vmware-player-distrib# uname -a
> Linux vmplayer 2.6.18-6-vserver-amd64 #1 SMP Fri Dec 12 06:15:44 UTC 2008 x86_64 GNU/Linux
> 
> 
> thx
> Ekkard