VMware Communities
Krellan
Enthusiast
Enthusiast

Here is patch for Workstation 6.5.1 on Linux 2.6.29 kernel

Here is something I'm proud of: a complete patch for getting VMware Workstation 6.5.1 to correctly compile its kernel modules against the new Linux 2.6.29 kernel.

It's attached.

I read the other threads here:

http://communities.vmware.com/message/1210084

http://communities.vmware.com/message/1141306

There were also patches posted to these threads, but after looking at them, I was concerned. There seems to be a serious error, as cap_raise() has been blindly changed to cap_raised(), which is actually a different API that has a completely different effect (it's a query instead of a set). Linux 2.6.29 changed capabilities a lot, evidently, and broke a lot of old code. I had to put in wrapper functions to call the capabilities change, because the new kernel shuffled things around quite a bit.

Also, the Makefile itself was failing to find the Linux kernel headers in many situations. This was a bug in VMware's Makefile: it wasn't including the $(HEADER_DIR) in its check for various features, which was causing misdetection of a lot of things earlier (the poll_initwait() problem).

I made what I believe are the minimum possible changes in order to get it to compile and load cleanly against 2.6.29. It's also in a single, unified, patch, that covers all 5 of the known working VMware modules (ignore vmppuser, it's pretty much dead code, I don't know why VMware still ships it, since it's not used by vmware-modconfig in any way that I could find).

To use this patch, download it from the attachment, gunzip it, then go to your /usr/lib/vmware/modules/source directory. Untar all of the files. Apply the patch with "patch -p1". After the patch has applied, re-tar all the files. Then, run "vmware-modconfig --console --install-all" again, under Linux 2.6.29, and it should now work. Please let me know your results, if it doesn't work. I tested it on an x86_64 machine with VMware Workstation 6.5.1 and it worked, but anything else is untested.

Exercises left to the reader:

1) Make a script to help people install this patch easier. It's error-prone to have to untar and re-tar files by hand.

2) Add in the KERNEL_VERSION checks to the code. Right now, I changed it just for 2.6.29. It could be made portable to other kernel versions as well by isolating the 2.6.29 changes in their own #if blocks.

Hope this helps!

Josh

Reply
0 Kudos
43 Replies
Krellan
Enthusiast
Enthusiast

It's probably an easy fix. I just need to get the original sources, so I can make a clean patch.

Is the modules directory the same between vmplayer 2.5.2 and Workstation 6.5.2? If so, then one patch will work to solve it for both products.

Reply
0 Kudos
Krellan
Enthusiast
Enthusiast

Nice, I see that VMware Workstation 6.5.2 has just been released. Downloading it now. Should have a new patch soon, assuming nobody else has beaten me to it yet Smiley Happy

Reply
0 Kudos
Krellan
Enthusiast
Enthusiast

Got it!

Here's the patch for 6.5.2:

http://communities.vmware.com/thread/203231

This thread should remain for only 6.5.1 issues, to avoid confusing people by mixing up 6.5.2 with 6.5.1.

So, if you are running VMware Workstation 6.5.2, or VMware Player 2.5.2, please go to this new thread, in order to grab my latest patch for 6.5.2.

Thanks!

Josh

Reply
0 Kudos
zwierbel
Enthusiast
Enthusiast

Same problem with VMware Workstation 6.5.2.

I can not believe that they give us a new version without support for 2.6.29.

Using the old 6.5.1 modules with the patch in 6.5.2 is working fine. But I don't know if that will open the security bugs mentioned in the release notes.....

Reply
0 Kudos
Krellan
Enthusiast
Enthusiast

zwierbel: This thread is getting somewhat crowded, with various overlapping problems and solutions, so please open a new thread.

For anyone using Workstation 6.5.2, I have posted an updated patch that should be applied against 6.5.2's modules. Please don't use the 6.5.1 patch any more with 6.5.2, because it will not work.

For anyone using Workstation 6.5.1, please consider upgrading to 6.5.2!

Here's the 6.5.2 patch:

http://communities.vmware.com/message/1218802

Josh

Reply
0 Kudos
barraski
Contributor
Contributor

Hi there

I would upgrade to 6.5.2 but couldn't find the version for Linux HOST, latest version available I've found is VMware-Workstation-6.5.1-126130.

I've tested your patch against 2.6.30rc2 (strictly is 2.6.30-020630rc2) but doesnt work, fails as follows:

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-root/modules/vmmon-only'
make -C /lib/modules/2.6.30-020630rc2-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.30-020630rc2-generic'
CC /tmp/vmware-root/modules/vmmon-only/linux/driver.o
In file included from /tmp/vmware-root/modules/vmmon-only/linux/driver.c:31:
/tmp/vmware-root/modules/vmmon-only/./include/compat_wait.h:78: error: conflicting types for ‘poll_initwait’
include/linux/poll.h:67: error: previous declaration of ‘poll_initwait’ was here
In file included from /tmp/vmware-root/modules/vmmon-only/./common/vmx86.h:31,
from /tmp/vmware-root/modules/vmmon-only/linux/driver.h:29,
from /tmp/vmware-root/modules/vmmon-only/linux/driver.c:101:
/tmp/vmware-root/modules/vmmon-only/./include/x86apic.h:97:1: warning: "APIC_BASE_MSR" redefined
In file included from /usr/src/linux-headers-2.6.30-020630rc2-generic/arch/x86/include/asm/apic.h:11,
from /usr/src/linux-headers-2.6.30-020630rc2-generic/arch/x86/include/asm/smp.h:13,
from include/linux/smp.h:36,
from include/linux/topology.h:33,
from include/linux/gfp.h:7,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /tmp/vmware-root/modules/vmmon-only/./include/compat_module.h:27,
from /tmp/vmware-root/modules/vmmon-only/linux/driver.c:26:
/usr/src/linux-headers-2.6.30-020630rc2-generic/arch/x86/include/asm/apicdef.h:133:1: warning: this is the location of the previous definition
/tmp/vmware-root/modules/vmmon-only/linux/driver.c: In function ‘LinuxDriverSyncCallOnEachCPU’:
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1423: error: too many arguments to function ‘smp_call_function’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c: In function ‘LinuxDriver_Ioctl’:
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1987: error: ‘struct task_struct’ has no member named ‘euid’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1987: error: ‘struct task_struct’ has no member named ‘uid’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1988: error: ‘struct task_struct’ has no member named ‘fsuid’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1988: error: ‘struct task_struct’ has no member named ‘uid’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1989: error: ‘struct task_struct’ has no member named ‘egid’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1989: error: ‘struct task_struct’ has no member named ‘gid’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1990: error: ‘struct task_struct’ has no member named ‘fsgid’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:1990: error: ‘struct task_struct’ has no member named ‘gid’
/tmp/vmware-root/modules/vmmon-only/linux/driver.c:2007: error: too many arguments to function ‘smp_call_function’
make[2]: *** Error 1
make[1]: *** Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.30-020630rc2-generic'
make: *** http://vmmon.ko Error 2
make: Leaving directory `/tmp/vmware-root/modules/vmmon-only'

Has anyone tried to produce a patch for 2.6.30 yet?

I'm aware it's stil a RC. the reasoning is that I've upgraded to Ubuntu 9.04 and have an intel graphics driver: in order to fix the poor performance I had to upgrade to 2.6.30RC2 kernel. I guess my config would be a quite common one.

I'm willing to beta test any patch you might kindly provide.

Thanks very much in advance.

Reply
0 Kudos
barraski
Contributor
Contributor

I do apologize: found the 6.5.2 version for Linux hosts. Problem was that under trial versions, you don't get to chose to download the v6.5.2, only 6.5.1.

Still, If anyone is willing somebody to help testing a patch for 2.6.30 kernels, don't hesitate to ask me Smiley Wink

Regards

Reply
0 Kudos
motri
Contributor
Contributor

Performance of current 6.5.x is unbearable.

I'd be happy to have a patch for 6.0.5 against 2.6.29 .... any clues?

Reply
0 Kudos
dk10tlx
Contributor
Contributor

worked great here on Debian 2.6.29-1-686 kernel with workstation 6.5.2 build-156735

thanks a lot

Reply
0 Kudos
dk10tlx
Contributor
Contributor

@barraski: yes I'm willing to help where I can.

Reply
0 Kudos
bergerkos
Contributor
Contributor

Hey, many great thanks to you! Nice job, especially with the script you wrote.

Your patch (along with the .sh script to apply it) worked out fine for me with VMware Server 2.0.1!!!

Only, I had to modify the patch a bit, so it could install:

as there are only vsock, vmmon, vmci, vmnet in the VMware Server, I had to remove the #1 chunk pertaining to vmblock-only;

      • source-OLD/vmblock-only/Makefile 2008-10-28 22:47:20.000000000 -0700
  • $(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
diff -urN source-OLD/vmblock-only/Makefile source-NEW/vmblock-only/Makefile
      • source-OLD/vmmon-only/include/x86apic.h 2008-10-28 22:47:17.000000000 -0700
+++ source-NEW/vmblock-only/Makefile 2009-03-26 19:29:30.000000000 -0700 @@ -113,7 +113,7 @@ vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \ + $(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \ -DKBUILD_BASENAME=\"$(DRIVER)\" \ -Werror -S -o /dev/null -xc $(1) \ > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi) then, in the next part: -


diff -urN source-OLD/vmmon-only/include/x86apic.h source-NEW/vmmon-only/include/x86apic.h +++ source-NEW/vmmon-only/include/x86apic.h 2009-03-31 11:18:30.000000000 -0700 @@ -94,7 +94,11 @@ #define APIC_LVT_DELVMODE(_lvt) (_lvt & 0x700) #define APIC_LVT_RESET_VALUE 0x00010000 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) #define APIC_BASE_MSR 0x1b

+#else +#define APIC_BASE_MSR 0x800 +#endif

-


there is actually no line "#define APIC_BASE_MSR 0x1b" in x86apic.h of this VMware Server 2.0.1 version, so I changed the section accordingly.

Or, perhaps, it was better to remove the section altogether? Well, I left the definition for the 2.6.29 kernel and it works fine so far. Logically though, it shouldn't change a lot even if it is not used at all, right? I must admit, I'm not a programmer at all -- just a DIY user.

So, thanks a lot! Nice job.

Reply
0 Kudos
Krellan
Enthusiast
Enthusiast

You're welcome! Glad it installed. As for APIC_BASE_MSR, I don't think this is used, either. It must have been causing more problems than it helped, because in Workstation 6.5.2, it's no longer there.

Josh

Reply
0 Kudos
kroser
Contributor
Contributor

bergerkos,

I couldn't actually follow the changes you made to the workstation patch to produce the server patch. Could you post your modified patch for Vmware Server 2.0.1?

Reply
0 Kudos
bergerkos
Contributor
Contributor

well that's actually pretty simple and straightforward.

First, you delete from the patch the first chunk, starting with "diff -urN source-OLD/vmblock-only/Makefile source-NEW/vmblock-only/Makefile".

Second, you also delete from the patch the chunk, starting with "diff -urN source-OLD/vmmon-only/include/x86apic.h source-NEW/vmmon-only/include/x86apic.h", because it is not actually needed at all.

That's it! Then you run the *.sh script and it does all the job successfully, making a complete testing of the results. After which you just run the normal command "vmware-config.pl".

Reply
0 Kudos
arth1
Contributor
Contributor

Instead of messing with the patch for VMWare Workstation, which misses some of the Server stuff, here's a quick fix for VMWare Server 2.x:

#!/bin/sh
cd /usr/lib/vmware-tools/modules/source || exit 10
/bin/ls -1 *.tar | xargs -n1 tar xf
perl -pi.bak -e 's/-Iinclude2/-I\$(HEADER_DIR) -Iinclude2/' */Makefile
/bin/ls -1 *.tar | sed 's/\.tar$//' | awk '{print "tar cf "$1".tar "$1"-only"}' | sh
/bin/rm -rf *-only

There will still be lots of warnings, but all modules except one should compile now.

Reply
0 Kudos
Fogliato
Contributor
Contributor

Thanks! Very, very, very thanks! You resolved my problem!

Reply
0 Kudos
hceuterpe
Contributor
Contributor

It's still breaking for me, after that server patch:

Using 2.6.x kernel build system. make: Entering directory `/tmp/vmware-config3/vmmon-only' make -C /lib/modules/2.6.29.4-167.fc11.x86_64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules make[1]: Entering directory `/usr/src/kernels/2.6.29.4-167.fc11.x86_64' CC /tmp/vmware-config3/vmmon-only/linux/driver.o In file included from /tmp/vmware-config3/vmmon-only/./include/vmware.h:38, from /tmp/vmware-config3/vmmon-only/linux/driver.c:99: /tmp/vmware-config3/vmmon-only/./include/vm_basic_types.h:108:7: warning: "__FreeBSD__" is not defined In file included from /tmp/vmware-config3/vmmon-only/./include/vcpuset.h:103, from /tmp/vmware-config3/vmmon-only/./include/modulecall.h:37, from /tmp/vmware-config3/vmmon-only/./common/vmx86.h:33, from /tmp/vmware-config3/vmmon-only/linux/driver.h:29, from /tmp/vmware-config3/vmmon-only/linux/driver.c:101: /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:329:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:333:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:401:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:407:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:460:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:506:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:551:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:595:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:640:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:684:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:729:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:773:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:775:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:816:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:860:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:862:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:903:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:945:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:947:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:986:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1028:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1030:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1069:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1223:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1227:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1313:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1536:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1663:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_atomic.h:1796:7: warning: "_MSC_VER" is not defined In file included from /tmp/vmware-config3/vmmon-only/./include/vm_asm_x86_64.h:39, from /tmp/vmware-config3/vmmon-only/./include/vm_asm.h:41, from /tmp/vmware-config3/vmmon-only/linux/driver.c:103: /tmp/vmware-config3/vmmon-only/./include/vm_asm_x86.h:486:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_asm_x86.h:779:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_asm_x86.h:820:7: warning: "_MSC_VER" is not defined /tmp/vmware-config3/vmmon-only/./include/vm_asm_x86.h:922:7: warning: "_MSC_VER" is not defined In file included from /tmp/vmware-config3/vmmon-only/./include/vm_asm.h:41, from /tmp/vmware-config3/vmmon-only/linux/driver.c:103: /tmp/vmware-config3/vmmon-only/./include/vm_asm_x86_64.h:56:7: warning: "_MSC_VER" is not defined In file included from /tmp/vmware-config3/vmmon-only/linux/driver.c:119: /tmp/vmware-config3/vmmon-only/./common/hostif.h:53:7: warning: "WINNT_DDK" is not defined /tmp/vmware-config3/vmmon-only/linux/driver.c: In function ‘LinuxDriver_Ioctl’: /tmp/vmware-config3/vmmon-only/linux/driver.c:1987: error: ‘struct task_struct’ has no member named ‘euid’ /tmp/vmware-config3/vmmon-only/linux/driver.c:1987: error: ‘struct task_struct’ has no member named ‘uid’ /tmp/vmware-config3/vmmon-only/linux/driver.c:1988: error: ‘struct task_struct’ has no member named ‘fsuid’ /tmp/vmware-config3/vmmon-only/linux/driver.c:1988: error: ‘struct task_struct’ has no member named ‘uid’ /tmp/vmware-config3/vmmon-only/linux/driver.c:1989: error: ‘struct task_struct’ has no member named ‘egid’ /tmp/vmware-config3/vmmon-only/linux/driver.c:1989: error: ‘struct task_struct’ has no member named ‘gid’ /tmp/vmware-config3/vmmon-only/linux/driver.c:1990: error: ‘struct task_struct’ has no member named ‘fsgid’ /tmp/vmware-config3/vmmon-only/linux/driver.c:1990: error: ‘struct task_struct’ has no member named ‘gid’ make[2]: *** Error 1 make[1]: *** Error 2 make[1]: Leaving directory `/usr/src/kernels/2.6.29.4-167.fc11.x86_64' make: *** http://vmmon.ko Error 2 make: Leaving directory `/tmp/vmware-config3/vmmon-only' Unable to build the vmmon module. For more information on how to troubleshoot module-related problems, please visit our Web site at "http://www.vmware.com/go/unsup-linux-products" and "http://www.vmware.com/go/unsup-linux-tools". Execution aborted.

Any ideas?

Reply
0 Kudos
bergerkos
Contributor
Contributor

Your error is the same as I had before I tried (successfully) the VMware Workstation patch. I mean, it gives the error, which reflects the missing definitions, which were added by that patch.

I feel I must try myself the "quick fix" by the friend above, which he kindly suggests instead of messing with the Workstation patch. Especially so, if that patch is missing some Server stuff (which I haven't felt yet).

Kostya

Reply
0 Kudos
arth1
Contributor
Contributor

Did you miss "all modules except one should compile now"?

Unless you suspend/resume the VM from the host side, you can get by without vmmon.

Reply
0 Kudos
gmarcotte3
Contributor
Contributor

tried to run the patch and it gives me this:

Found tar file for vsock module

Found tar file for vmnet module

Found tar file for vmmon module

Found tar file for vmblock module

Found tar file for vmppuser module

Found tar file for vmci module

Using patch file: /root/vmware-6.5.2-modules-2.6.29-fix.patch

Using module directory: /usr/lib/vmware/modules/source

Using backup directory: /usr/lib/vmware/modules/source-backup

Backing up ./vsock.tar to /usr/lib/vmware/modules/source-backup/./vsock.tar

Backing up ./vmnet.tar to /usr/lib/vmware/modules/source-backup/./vmnet.tar

Backing up ./vmmon.tar to /usr/lib/vmware/modules/source-backup/./vmmon.tar

Backing up ./vmblock.tar to /usr/lib/vmware/modules/source-backup/./vmblock.tar

Backing up ./vmppuser.tar to /usr/lib/vmware/modules/source-backup/./vmppuser.tar

Backing up ./vmci.tar to /usr/lib/vmware/modules/source-backup/./vmci.tar

Untarring vsock.tar

Untarring vmnet.tar

Untarring vmmon.tar

Untarring vmblock.tar

Untarring vmppuser.tar

Untarring vmci.tar

Testing patch

patching file vmblock-only/Makefile

Hunk #1 FAILED at 122.

1 out of 1 hunk FAILED -- saving rejects to file vmblock-only/Makefile.rej

patching file vmci-only/Makefile

patching file vmmon-only/include/x86apic.h

Hunk #1 succeeded at 78 with fuzz 2 (offset -16 lines).

patching file vmmon-only/linux/driver.c

Hunk #1 FAILED at 1984.

1 out of 1 hunk FAILED -- saving rejects to file vmmon-only/linux/driver.c.rej

patching file vmmon-only/linux/hostif.c

Hunk #1 succeeded at 3226 (offset -198 lines).

Hunk #2 FAILED at 3340.

Hunk #3 FAILED at 3464.

2 out of 3 hunks FAILED -- saving rejects to file vmmon-only/linux/hostif.c.rej

patching file vmmon-only/Makefile

Hunk #1 FAILED at 122.

1 out of 1 hunk FAILED -- saving rejects to file vmmon-only/Makefile.rej

patching file vmnet-only/Makefile

Hunk #1 FAILED at 122.

1 out of 1 hunk FAILED -- saving rejects to file vmnet-only/Makefile.rej

patching file vmnet-only/netif.c

Hunk #1 FAILED at 324.

Hunk #2 succeeded at 533 (offset -37 lines).

Hunk #4 succeeded at 650 (offset -37 lines).

1 out of 4 hunks FAILED -- saving rejects to file vmnet-only/netif.c.rej

patching file vsock-only/Makefile

Sorry, problem with the patch, I can't apply it

so what do I have to do to run this patch?

~~~~(\_~~~~
Reply
0 Kudos