Comments

KERNEL – 4.6-rc1 Released – OK with Latest VMware, Breaks NVIDIA – and a Possible Fix.. — 5 Comments

  1. Hi!

    vmware doesn’t compile with newer rc versions. I tried the newest from vmware (VMware Workstation 12.1.1 build-3770994)

    The issue is that a macro which used to suck was changed in the kernel: commit c12d2da56d0e07d230968ee2305aaa86b93a6832

    relevant text is:
    old:
    ret = get_user_pages(current, current->mm, address, 1, 1, 0, &page, NULL);

    new:
    ret = get_user_pages(address, 1, 1, 0, &page, NULL);

    vmware has two modules, vmnet and vmmod which have both of those.

    diff –git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
    index d1bc8ba..ffee9ee 100644
    — a/vmmon-only/linux/hostif.c
    +++ b/vmmon-only/linux/hostif.c
    @@ -1162,8 +1162,13 @@ HostIFGetUserPages(void *uvAddr, // IN
    int retval;

    down_read(&current->mm->mmap_sem);
    – retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
    – numPages, 0, 0, ppages, NULL);
    + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    + retval = get_user_pages((unsigned long)uvAddr,
    + numPages, 0, 0, ppages, NULL);
    + #else
    + retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
    + numPages, 0, 0, ppages, NULL);
    + #endif
    up_read(&current->mm->mmap_sem);

    return retval != numPages;
    diff –git a/vmnet-only/userif.c b/vmnet-only/userif.c
    index 4e457ba..33d910d 100644
    — a/vmnet-only/userif.c
    +++ b/vmnet-only/userif.c
    @@ -113,8 +113,12 @@ UserifLockPage(VA addr) // IN
    int retval;

    down_read(&current->mm->mmap_sem);
    – retval = get_user_pages(current, current->mm, addr,
    – 1, 1, 0, &page, NULL);
    + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    + retval = get_user_pages(addr, 1, 1, 0, &page, NULL);
    + #else
    + retval = get_user_pages(current, current->mm, addr,
    + 1, 1, 0, &page, NULL);
    + #endif
    up_read(&current->mm->mmap_sem);

    if (retval != 1) {

    although as I’m writing this out to you, I could probably combine a few things.

    Anyway, thank you for your previous post patching vmmon! This is nowhere near as challenging, and probably the easiest “it doesn’t compile” I have ever seen (since everything was stated, and the git log had an explicit statement of what to change for the kernel), but maybe I have saved someone else a min or two of time. I figure if I get 100+people, that’s maybe an hour or so saved, which is nice!

    – Justin

  2. Well that was ugly.

    just followed the lkml syntax and added/changed:

    # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    ret = get_user_pages(address, 1, 1, 0, &page, NULL);
    # else
    ret = get_user_pages(current, current->mm, address, 1, 1, 0, &page, NULL);
    # endif

    files were:
    vmmon-only/linux/hostif.c (line 1166)
    vmnet-only/userif.c (line 116)

    • Many thanks for spotting that – I had not yet tested it..! And thanks also for the patches… I tried the first (long-form) one, and had to slightly modify the format to get the vmnet portion to apply, for some reason..:

      diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
      --- a/vmmon-only/linux/hostif.c
      +++ b/vmmon-only/linux/hostif.c
      @@ -1162,8 +1162,13 @@
      int retval;

      down_read(&current->mm->mmap_sem);
      - retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
      - numPages, 0, 0, ppages, NULL);
      + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
      + retval = get_user_pages((unsigned long)uvAddr,
      + numPages, 0, 0, ppages, NULL);
      + #else
      + retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
      + numPages, 0, 0, ppages, NULL);
      + #endif
      up_read(&current->mm->mmap_sem);

      return retval != numPages;
      diff --git a/vmnet-only/userif.c b/vmnet-only/userif.c
      --- a/vmnet-only/userif.c 2016-04-22 19:19:36.852205070 -0700
      +++ b/vmnet-only/userif.c 2016-04-22 19:21:26.317845433 -0700
      @@ -113,8 +113,12 @@
      int retval;

      down_read(&current->mm->mmap_sem);
      - retval = get_user_pages(current, current->mm, addr,
      - 1, 1, 0, &page, NULL);
      + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
      + retval = get_user_pages(addr, 1, 1, 0, &page, NULL);
      + #else
      + retval = get_user_pages(current, current->mm, addr,
      + 1, 1, 0, &page, NULL);
      + #endif
      up_read(&current->mm->mmap_sem);

      if (retval != 1) {

      RG.

  3. please help me …..
    when i run “vmware-modconfig –console –install-all”

    make: Entering directory ‘/tmp/modconfig-32nZFw/vmnet-only’
    Using kernel build system.
    /usr/bin/make -C /lib/modules/4.6.0-kali1-amd64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
    MODULEBUILDDIR= modules
    make[1]: Entering directory ‘/usr/src/linux-headers-4.6.0-kali1-amd64’
    CC [M] /tmp/modconfig-32nZFw/vmnet-only/driver.o
    CC [M] /tmp/modconfig-32nZFw/vmnet-only/hub.o
    CC [M] /tmp/modconfig-32nZFw/vmnet-only/userif.o
    CC [M] /tmp/modconfig-32nZFw/vmnet-only/netif.o
    In file included from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/pci.h:35:0,
    from /tmp/modconfig-32nZFw/vmnet-only/compat_netdevice.h:27,
    from /tmp/modconfig-32nZFw/vmnet-only/netif.c:43:
    /usr/src/linux-headers-4.6.0-kali1-common/include/linux/pci_ids.h:2253:0: warning: “PCI_VENDOR_ID_VMWARE” redefined
    #define PCI_VENDOR_ID_VMWARE 0x15ad
    ^
    In file included from /tmp/modconfig-32nZFw/vmnet-only/net.h:38:0,
    from /tmp/modconfig-32nZFw/vmnet-only/vnetInt.h:26,
    from /tmp/modconfig-32nZFw/vmnet-only/netif.c:42:
    /tmp/modconfig-32nZFw/vmnet-only/vm_device_version.h:56:0: note: this is the location of the previous definition
    #define PCI_VENDOR_ID_VMWARE 0x15AD
    ^
    In file included from /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/processor.h:15:0,
    from /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/cpufeature.h:4,
    from /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/thread_info.h:52,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/thread_info.h:54,
    from /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/preempt.h:6,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/preempt.h:59,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/spinlock.h:50,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/wait.h:8,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/fs.h:5,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/highmem.h:4,
    from /tmp/modconfig-32nZFw/vmnet-only/userif.c:26:
    /tmp/modconfig-32nZFw/vmnet-only/userif.c: In function ‘UserifLockPage’:
    /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/current.h:17:17: warning: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
    #define current get_current()
    ^
    /tmp/modconfig-32nZFw/vmnet-only/userif.c:116:28: note: in expansion of macro ‘current’
    retval = get_user_pages(current, current->mm, addr,
    ^
    In file included from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/highmem.h:7:0,
    from /tmp/modconfig-32nZFw/vmnet-only/userif.c:26:
    /usr/src/linux-headers-4.6.0-kali1-common/include/linux/mm.h:1288:6: note: expected ‘long unsigned int’ but argument is of type ‘struct task_struct *’
    long get_user_pages(unsigned long start, unsigned long nr_pages,
    ^
    In file included from /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/processor.h:15:0,
    from /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/cpufeature.h:4,
    from /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/thread_info.h:52,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/thread_info.h:54,
    from /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/preempt.h:6,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/preempt.h:59,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/spinlock.h:50,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/wait.h:8,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/fs.h:5,
    from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/highmem.h:4,
    from /tmp/modconfig-32nZFw/vmnet-only/userif.c:26:
    /usr/src/linux-headers-4.6.0-kali1-common/arch/x86/include/asm/current.h:17:17: warning: passing argument 2 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
    #define current get_current()
    ^
    /tmp/modconfig-32nZFw/vmnet-only/userif.c:116:37: note: in expansion of macro ‘current’
    retval = get_user_pages(current, current->mm, addr,
    ^
    In file included from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/highmem.h:7:0,
    from /tmp/modconfig-32nZFw/vmnet-only/userif.c:26:
    /usr/src/linux-headers-4.6.0-kali1-common/include/linux/mm.h:1288:6: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
    long get_user_pages(unsigned long start, unsigned long nr_pages,
    ^
    /tmp/modconfig-32nZFw/vmnet-only/userif.c:117:10: warning: passing argument 5 of ‘get_user_pages’ makes pointer from integer without a cast [-Wint-conversion]
    1, 1, 0, &page, NULL);
    ^
    In file included from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/highmem.h:7:0,
    from /tmp/modconfig-32nZFw/vmnet-only/userif.c:26:
    /usr/src/linux-headers-4.6.0-kali1-common/include/linux/mm.h:1288:6: note: expected ‘struct page **’ but argument is of type ‘int’
    long get_user_pages(unsigned long start, unsigned long nr_pages,
    ^
    /tmp/modconfig-32nZFw/vmnet-only/userif.c:116:13: error: too many arguments to function ‘get_user_pages’
    retval = get_user_pages(current, current->mm, addr,
    ^
    In file included from /usr/src/linux-headers-4.6.0-kali1-common/include/linux/highmem.h:7:0,
    from /tmp/modconfig-32nZFw/vmnet-only/userif.c:26:
    /usr/src/linux-headers-4.6.0-kali1-common/include/linux/mm.h:1288:6: note: declared here
    long get_user_pages(unsigned long start, unsigned long nr_pages,
    ^
    /usr/src/linux-headers-4.6.0-kali1-common/scripts/Makefile.build:296: recipe for target ‘/tmp/modconfig-32nZFw/vmnet-only/userif.o’ failed
    make[4]: *** [/tmp/modconfig-32nZFw/vmnet-only/userif.o] Error 1
    make[4]: *** Waiting for unfinished jobs….
    /usr/src/linux-headers-4.6.0-kali1-common/Makefile:1446: recipe for target ‘_module_/tmp/modconfig-32nZFw/vmnet-only’ failed
    make[3]: *** [_module_/tmp/modconfig-32nZFw/vmnet-only] Error 2
    Makefile:146: recipe for target ‘sub-make’ failed
    make[2]: *** [sub-make] Error 2
    Makefile:8: recipe for target ‘all’ failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory ‘/usr/src/linux-headers-4.6.0-kali1-amd64’
    Makefile:120: recipe for target ‘vmnet.ko’ failed
    make: *** [vmnet.ko] Error 2
    make: Leaving directory ‘/tmp/modconfig-32nZFw/vmnet-only’
    Unable to install all modules. See log for details

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.