Advertisement
Guest User

Patches for vmware-patch aur package to support kernel 4.2.5

a guest
Dec 15th, 2015
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.87 KB | None | 0 0
  1. $ cat /usr/lib/vmware/modules/patches/vmmon-12.0.0-4.2.patch
  2. --- vmmon-only/linux/driver.c   2015-11-23 14:12:17.329780992 +0200
  3. +++ vmmon-only/linux/driver.c.new       2015-11-23 14:18:46.159776291 +0200
  4. @@ -400,9 +400,7 @@
  5.  #ifdef VMX86_DEVEL
  6.     unregister_chrdev(linuxState.major, linuxState.deviceName);
  7.  #else
  8. -   if (misc_deregister(&linuxState.misc)) {
  9. -      Warning("Module %s: error unregistering\n", linuxState.deviceName);
  10. -   }
  11. +   misc_deregister(&linuxState.misc);
  12.  #endif
  13.  
  14.     Log("Module %s: unloaded\n", linuxState.deviceName);
  15.  
  16.  
  17. --------------------------------------------------------------------------------------------------
  18.  
  19.  
  20. $ cat /usr/lib/vmware/modules/patches/vmci-12.0.0-4.2.patch
  21. diff -ur a/vmci-only/linux/driver.c b/vmci-only/linux/driver.c
  22. --- vmci-only/linux/driver.c    2015-05-31 16:01:25.000000000 +0300
  23. +++ vmci-only/linux/driver.c    2015-08-08 00:42:47.000000000 +0300
  24. @@ -26,13 +26,16 @@
  25.  
  26.  #include <linux/file.h>
  27.  #include <linux/fs.h>
  28. +#include <linux/vmalloc.h>
  29.  #include <linux/init.h>
  30. +
  31.  #if defined(__x86_64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
  32.  #   include <linux/ioctl32.h>
  33.  /* Use weak: not all kernels export sys_ioctl for use by modules */
  34.  asmlinkage __attribute__((weak)) long
  35.  sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
  36.  #endif
  37. +
  38.  #include <linux/miscdevice.h>
  39.  #include <linux/moduleparam.h>
  40.  #include <linux/poll.h>
  41. @@ -713,7 +716,7 @@
  42.  
  43.     case IOCTL_VMCI_INIT_CONTEXT: {
  44.        VMCIInitBlock initBlock;
  45. -      VMCIHostUser user;
  46. +      uid_t user;
  47.  
  48.        retval = copy_from_user(&initBlock, (void *)ioarg, sizeof initBlock);
  49.        if (retval != 0) {
  50. @@ -735,7 +738,11 @@
  51.           goto init_release;
  52.        }
  53.  
  54. +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
  55.        user = current_uid();
  56. +#else
  57. +      user = from_kuid(&init_user_ns, current_uid());
  58. +#endif
  59.        retval = VMCIContext_InitContext(initBlock.cid, initBlock.flags,
  60.                                         0 /* Unused */, vmciLinux->userVersion,
  61.                                         &user, &vmciLinux->context);
  62. @@ -1683,7 +1690,7 @@
  63.     /* This should be last to make sure we are done initializing. */
  64.     retval = pci_register_driver(&vmci_driver);
  65.     if (retval < 0) {
  66. -      vfree(data_buffer);
  67. +      kvfree(data_buffer);
  68.        data_buffer = NULL;
  69.        return retval;
  70.     }
  71. @@ -2470,7 +2477,7 @@
  72.  
  73.     if (guestDeviceInit) {
  74.        pci_unregister_driver(&vmci_driver);
  75. -      vfree(data_buffer);
  76. +      kvfree(data_buffer);
  77.        guestDeviceInit = FALSE;
  78.     }
  79.  
  80. diff -ur a/vmci-only/linux/vmciKernelIf.c b/vmci-only/linux/vmciKernelIf.c
  81. --- vmci-only/linux/vmciKernelIf.c  2015-05-31 16:01:25.000000000 +0300
  82. +++ vmci-only/linux/vmciKernelIf.c  2015-02-24 03:58:06.000000000 +0300
  83. @@ -40,6 +40,7 @@
  84.  #include <linux/socket.h>       /* For memcpy_{to,from}iovec(). */
  85.  #include <linux/vmalloc.h>
  86.  #include <linux/wait.h>
  87. +#include <linux/skbuff.h>
  88.  
  89.  #include "compat_highmem.h"
  90.  #include "compat_interrupt.h"
  91. @@ -1196,21 +1197,21 @@
  92.        } else {
  93.           toCopy = size - bytesCopied;
  94.        }
  95. -
  96. +      /* Code cloned from kernels drivers/misc/vmw_vmci/vmci_queue_pair.c */
  97.        if (isIovec) {
  98. -         struct iovec *iov = (struct iovec *)src;
  99. -         int err;
  100. +            struct msghdr *msg = (struct msghdr *)src;
  101. +            int err;
  102.  
  103. -         /* The iovec will track bytesCopied internally. */
  104. -         err = memcpy_fromiovec((uint8 *)va + pageOffset, iov, toCopy);
  105. -         if (err != 0) {
  106. -            if (kernelIf->host) {
  107. -               kunmap(kernelIf->u.h.page[pageIndex]);
  108. +            /* The iovec will track bytes_copied internally. */
  109. +            err = memcpy_from_msg((u8 *)va + pageOffset, msg, toCopy);
  110. +            if (err != 0) {
  111. +                    if (kernelIf->host)
  112. +                            kunmap(kernelIf->u.h.page[pageIndex]);
  113. +                    return VMCI_ERROR_INVALID_ARGS;
  114.              }
  115. -            return VMCI_ERROR_INVALID_ARGS;
  116. -         }
  117. -      } else {
  118. -         memcpy((uint8 *)va + pageOffset, (uint8 *)src + bytesCopied, toCopy);
  119. +        } else {
  120. +            memcpy((u8 *)va + pageOffset,
  121. +                   (u8 *)src + bytesCopied, toCopy);
  122.        }
  123.  
  124.        bytesCopied += toCopy;
  125. @@ -1273,11 +1274,11 @@
  126.        }
  127.  
  128.        if (isIovec) {
  129. -         struct iovec *iov = (struct iovec *)dest;
  130. +    struct msghdr *msg = (struct msghdr *)dest;
  131.           int err;
  132.  
  133.           /* The iovec will track bytesCopied internally. */
  134. -         err = memcpy_toiovec(iov, (uint8 *)va + pageOffset, toCopy);
  135. +    err = memcpy_to_msg(msg, (uint8 *)va + pageOffset, toCopy);
  136.           if (err != 0) {
  137.              if (kernelIf->host) {
  138.                 kunmap(kernelIf->u.h.page[pageIndex]);
  139. diff -ur a/vmci-only/shared/vm_device_version.h b/vmci-only/shared/vm_device_version.h
  140. --- vmci-only/shared/vm_device_version.h    2015-05-31 16:01:26.000000000 +0300
  141. +++ vmci-only/shared/vm_device_version.h    2015-02-24 03:58:06.000000000 +0300
  142. @@ -53,7 +53,9 @@
  143.   *    VMware HD Audio codec
  144.   *    VMware HD Audio controller
  145.   */
  146. +#ifndef PCI_VENDOR_ID_VMWARE
  147.  #define PCI_VENDOR_ID_VMWARE                    0x15AD
  148. +#endif
  149.  #define PCI_DEVICE_ID_VMWARE_SVGA2              0x0405
  150.  #define PCI_DEVICE_ID_VMWARE_SVGA               0x0710
  151.  #define PCI_DEVICE_ID_VMWARE_VGA                0x0711
  152. --- vmci-only/linux/driver.c    2015-11-23 14:35:55.339763849 +0200
  153. +++ vmci-only/linux/driver.c.new    2015-11-23 14:38:57.439761647 +0200
  154. @@ -2484,12 +2484,7 @@
  155.  
  156.        VMCI_HostCleanup();
  157.  
  158. -      retval = misc_deregister(&linuxState.misc);
  159. -      if (retval) {
  160. -         Warning(LGPFX "Module %s: error unregistering\n", VMCI_MODULE_NAME);
  161. -      } else {
  162. -         Log(LGPFX"Module %s: unloaded\n", VMCI_MODULE_NAME);
  163. -      }
  164. +      misc_deregister(&linuxState.misc);
  165.  
  166.        hostDeviceInit = FALSE;
  167.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement