mkubecek / vmware-host-modules

Patches needed to build VMware (Player and Workstation) host modules against recent kernels
GNU General Public License v2.0
2.31k stars 381 forks source link

Make fails for w16.2.5 and k6.2.0 #231

Closed edelpeon closed 1 year ago

edelpeon commented 1 year ago

On Ubuntu with Kernel 6.2.0-37-generic make throws a "csum_and_copy_to_user" undefined error

make -C vmmon-only 
make[1]: Entering directory '/tmp/vmware-host-modules-w16.2.5/vmmon-only'
Using kernel build system.
make -C /lib/modules/6.2.0-37-generic/build/include/.. M=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[2]: Entering directory '/usr/src/linux-headers-6.2.0-37-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  You are using:           gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/linux/driver.o
In file included from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/cpu_types.h:29,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/modulecall.h:33,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./common/vmx86.h:33,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/linux/driver.h:32,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/linux/driver.c:47:
/tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/vm_basic_defs.h:753: warning: "DO_ONCE" redefined
  753 | #define DO_ONCE(code)                                                   \
      | 
In file included from ./include/linux/prandom.h:12,
                 from ./include/linux/random.h:153,
                 from ./include/linux/nodemask.h:97,
                 from ./include/linux/list_lru.h:12,
                 from ./include/linux/fs.h:13,
                 from ./include/linux/highmem.h:5,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/linux/driver.c:25:
./include/linux/once.h:46: note: this is the location of the previous definition
   46 | #define DO_ONCE(func, ...)                                                   \
      | 
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/linux/driverLog.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/linux/hostif.o
In file included from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/cpu_types.h:29,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/modulecall.h:33,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/linux/hostif.c:58:
/tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/vm_basic_defs.h:753: warning: "DO_ONCE" redefined
  753 | #define DO_ONCE(code)                                                   \
      | 
In file included from ./include/linux/prandom.h:12,
                 from ./include/linux/random.h:153,
                 from ./include/linux/nodemask.h:97,
                 from ./include/linux/sched.h:23,
                 from ./include/linux/binfmts.h:5,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/linux/hostif.c:31:
./include/linux/once.h:46: note: this is the location of the previous definition
   46 | #define DO_ONCE(func, ...)                                                   \
      | 
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/apic.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/comport.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/cpuid.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/crosspage.o
/tmp/vmware-host-modules-w16.2.5/vmmon-only/common/crosspage.o: warning: objtool: CrossPage_CodePage+0x1f7: 'naked' return found in RETHUNK build
/tmp/vmware-host-modules-w16.2.5/vmmon-only/common/crosspage.o: warning: objtool: CrossPage_CodePage+0x1f7: missing int3 after ret
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/memtrack.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/moduleloop.o
In file included from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/cpu_types.h:29,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/modulecall.h:33,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/moduleloop.c:33:
/tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/vm_basic_defs.h:753: warning: "DO_ONCE" redefined
  753 | #define DO_ONCE(code)                                                   \
      | 
In file included from ./include/linux/prandom.h:12,
                 from ./include/linux/random.h:153,
                 from ./include/linux/nodemask.h:97,
                 from ./include/linux/sched.h:23,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/moduleloop.c:31:
./include/linux/once.h:46: note: this is the location of the previous definition
   46 | #define DO_ONCE(func, ...)                                                   \
      | 
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/phystrack.o
/tmp/vmware-host-modules-w16.2.5/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Free() falls through to next function PhysTrack_Add()
/tmp/vmware-host-modules-w16.2.5/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Add() falls through to next function PhysTrack_Remove()
/tmp/vmware-host-modules-w16.2.5/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Remove() falls through to next function PhysTrack_Test()
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/sharedAreaVmmon.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/statVarsVmmon.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/task.o
/tmp/vmware-host-modules-w16.2.5/vmmon-only/common/task.o: warning: objtool: .text: unexpected end of section
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/vmx86.o
In file included from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/cpu_types.h:29,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/modulecall.h:33,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/vmx86.h:33,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/vmx86.c:42:
/tmp/vmware-host-modules-w16.2.5/vmmon-only/./include/vm_basic_defs.h:753: warning: "DO_ONCE" redefined
  753 | #define DO_ONCE(code)                                                   \
      | 
In file included from ./include/linux/prandom.h:12,
                 from ./include/linux/random.h:153,
                 from ./include/linux/nodemask.h:97,
                 from ./include/linux/sched.h:23,
                 from /tmp/vmware-host-modules-w16.2.5/vmmon-only/common/vmx86.c:31:
./include/linux/once.h:46: note: this is the location of the previous definition
   46 | #define DO_ONCE(func, ...)                                                   \
      | 
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/bootstrap/bootstrap.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/bootstrap/monLoader.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/bootstrap/monLoaderVmmon.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/bootstrap/vmmblob.o
  LD [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/vmmon.o
  MODPOST /tmp/vmware-host-modules-w16.2.5/vmmon-only/Module.symvers
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/vmmon.mod.o
  LD [M]  /tmp/vmware-host-modules-w16.2.5/vmmon-only/vmmon.ko
  BTF [M] /tmp/vmware-host-modules-w16.2.5/vmmon-only/vmmon.ko
Skipping BTF generation for /tmp/vmware-host-modules-w16.2.5/vmmon-only/vmmon.ko due to unavailability of vmlinux
make[2]: Leaving directory '/usr/src/linux-headers-6.2.0-37-generic'
make -C $PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= postbuild
make[2]: Entering directory '/tmp/vmware-host-modules-w16.2.5/vmmon-only'
make[2]: 'postbuild' is up to date.
make[2]: Leaving directory '/tmp/vmware-host-modules-w16.2.5/vmmon-only'
cp -f vmmon.ko ./../vmmon.o
make[1]: Leaving directory '/tmp/vmware-host-modules-w16.2.5/vmmon-only'
make -C vmnet-only 
make[1]: Entering directory '/tmp/vmware-host-modules-w16.2.5/vmnet-only'
Using kernel build system.
make -C /lib/modules/6.2.0-37-generic/build/include/.. M=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[2]: Entering directory '/usr/src/linux-headers-6.2.0-37-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  You are using:           gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/driver.o
/tmp/vmware-host-modules-w16.2.5/vmnet-only/driver.c: In function ‘VNetFileOpUnlockedIoctl’:
/tmp/vmware-host-modules-w16.2.5/vmnet-only/driver.c:966:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
  966 |       {
      |       ^
/tmp/vmware-host-modules-w16.2.5/vmnet-only/driver.c:976:4: note: here
  976 |    case SIOCGETAPIVERSION:
      |    ^~~~
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/hub.o
/tmp/vmware-host-modules-w16.2.5/vmnet-only/hub.c:237:24: warning: argument 1 of type ‘uint8[]’ {aka ‘unsigned char[]’} with mismatched bound  -Warray-parameter=]
  237 | VNetHub_AllocPvn(uint8 id[]) // IN: the PVN ID to alloc on
      |                  ~~~~~~^~~~
In file included from /tmp/vmware-host-modules-w16.2.5/vmnet-only/hub.c:43:
/tmp/vmware-host-modules-w16.2.5/vmnet-only/vnetInt.h:173:34: note: previously declared as ‘uint8[20]’ {aka ‘unsigned char[20]’}
  173 | VNetJack *VNetHub_AllocPvn(uint8 id[VNET_PVN_ID_LEN]);
      |                            ~~~~~~^~~~~~~~~~~~~~~~~~~
/tmp/vmware-host-modules-w16.2.5/vmnet-only/hub.c:261:20: warning: argument 3 of type ‘uint8[]’ {aka ‘unsigned char[]’} with mismatched bound  -Warray-parameter=]
  261 |              uint8 id[])    // IN: PVN ID to use (NULL if allocPvn == FALSE)
      |              ~~~~~~^~~~
/tmp/vmware-host-modules-w16.2.5/vmnet-only/hub.c:68:37: note: previously declared as ‘uint8[20]’ {aka ‘unsigned char[20]’}
   68 |                               uint8 id[VNET_PVN_ID_LEN]);
      |                               ~~~~~~^~~~~~~~~~~~~~~~~~~
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/userif.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.o
In file included from ./include/linux/string.h:253,
                 from ./include/linux/bitmap.h:11,
                 from ./include/linux/cpumask.h:12,
                 from ./arch/x86/include/asm/paravirt.h:17,
                 from ./arch/x86/include/asm/irqflags.h:63,
                 from ./include/linux/irqflags.h:16,
                 from ./include/linux/rcupdate.h:26,
                 from ./include/linux/rculist.h:11,
                 from ./include/linux/pid.h:5,
                 from ./include/linux/sched.h:14,
                 from /tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:25:
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c: In function ‘VNetNetIf_Create’:
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:256:14: warning: passing argument 1 of ‘__builtin_memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  256 |    memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
      |           ~~~^~~~~~~~~~
./include/linux/fortify-string.h:578:27: note: in definition of macro ‘__fortify_memcpy_chk’
  578 |         __underlying_##op(p, q, __fortify_size);                        \
      |                           ^
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:256:4: note: in expansion of macro ‘memcpy’
  256 |    memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
      |    ^~~~~~
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:256:14: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
  256 |    memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
      |           ~~~^~~~~~~~~~
./include/linux/fortify-string.h:578:27: note: in definition of macro ‘__fortify_memcpy_chk’
  578 |         __underlying_##op(p, q, __fortify_size);                        \
      |                           ^
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:256:4: note: in expansion of macro ‘memcpy’
  256 |    memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
      |    ^~~~~~
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c: In function ‘VNetNetifSetMAC’:
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:535:14: warning: passing argument 1 of ‘__builtin_memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  535 |    memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
      |           ~~~^~~~~~~~~~
./include/linux/fortify-string.h:578:27: note: in definition of macro ‘__fortify_memcpy_chk’
  578 |         __underlying_##op(p, q, __fortify_size);                        \
      |                           ^
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:535:4: note: in expansion of macro ‘memcpy’
  535 |    memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
      |    ^~~~~~
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:535:14: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
  535 |    memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
      |           ~~~^~~~~~~~~~
./include/linux/fortify-string.h:578:27: note: in definition of macro ‘__fortify_memcpy_chk’
  578 |         __underlying_##op(p, q, __fortify_size);                        \
      |                           ^
/tmp/vmware-host-modules-w16.2.5/vmnet-only/netif.c:535:4: note: in expansion of macro ‘memcpy’
  535 |    memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
      |    ^~~~~~
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/bridge.o
/tmp/vmware-host-modules-w16.2.5/vmnet-only/bridge.c: In function ‘VNetBridgeUp’:
/tmp/vmware-host-modules-w16.2.5/vmnet-only/bridge.c:956:47: warning: passing argument 2 of ‘SMAC_SetMac’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  956 |          SMAC_SetMac(bridge->smac, bridge->dev->dev_addr);
      |                                    ~~~~~~~~~~~^~~~~~~~~~
In file included from /tmp/vmware-host-modules-w16.2.5/vmnet-only/bridge.c:54:
/tmp/vmware-host-modules-w16.2.5/vmnet-only/smac.h:75:45: note: expected ‘uint8 *’ {aka ‘unsigned char *’} but argument is of type ‘const unsigned char *’
   75 | SMAC_SetMac(struct SMACState *state, uint8 *mac); // IN: state, and host MAC
      |                                      ~~~~~~~^~~
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/procfs.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/smac_compat.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/smac.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/vnetEvent.o
  CC [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/vnetUserListener.o
  LD [M]  /tmp/vmware-host-modules-w16.2.5/vmnet-only/vmnet.o
  MODPOST /tmp/vmware-host-modules-w16.2.5/vmnet-only/Module.symvers
ERROR: modpost: "csum_and_copy_to_user" [/tmp/vmware-host-modules-w16.2.5/vmnet-only/vmnet.ko] undefined!
make[3]: *** [scripts/Makefile.modpost:138: /tmp/vmware-host-modules-w16.2.5/vmnet-only/Module.symvers] Error 1
make[2]: *** [Makefile:1978: modpost] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-6.2.0-37-generic'
make[1]: *** [Makefile:117: vmnet.ko] Error 2
make[1]: Leaving directory '/tmp/vmware-host-modules-w16.2.5/vmnet-only'
make: *** [Makefile:21: vmnet-only] Error 2
mkubecek commented 1 year ago

The warning about different compiler version is related to your build environment and in this case can be safely ignored. The rest are problems that have been addressed long ago. Most likely you are trying to build either from unpatched source or from a very old branch snapshot. My guess is the former, based on "-w6.2.5" in the name of your directory.

edelpeon commented 1 year ago

The warning about different compiler version is related to your build environment and in this case can be safely ignored. The rest are problems that have been addressed long ago. Most likely you are trying to build either from unpatched source or from a very old branch snapshot. My guess is the former, based on "-w6.2.5" in the name of your directory.

I'm not using 6.2.5, my directories are w16.2.5. I re-downloaded and same problem happens

mkubecek commented 1 year ago

The typo does not matter, what does is that the directory name indicates you checked out tag w16.2.5 which marks unpatched source from VMware. What you need is branch workstation-16.2.5 with patched sources. Please read the INSTALL file and follow the instructions.