Skip to content

Instantly share code, notes, and snippets.

@krobertson
Last active September 30, 2015 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save krobertson/9a3ffa2d9429df63d724 to your computer and use it in GitHub Desktop.
Save krobertson/9a3ffa2d9429df63d724 to your computer and use it in GitHub Desktop.
AUR package vmware-patch patch for Workstation 11.1.2 with 4.2 kernel
From 1fb71794b4d53d203fc64dc5d57baa5850991303 Mon Sep 17 00:00:00 2001
From: Ken Robertson <ken@invalidlogic.com>
Date: Tue, 29 Sep 2015 12:58:00 -0700
Subject: [PATCH] Applied patches for Workstation 11.1.2 on 4.2 kernel.
Patches were taken from the VMware forums here:
https://communities.vmware.com/thread/517279
---
PKGBUILD | 14 +-
vmblock-11.1.2-4.2.patch | 339 +++++++++++++++++++++++++++++++++++++++++++++++
vmci-11.1.2-4.2.patch | 131 ++++++++++++++++++
vmmon-11.1.2-4.2.patch | 24 ++++
vmnet-11.1.2-4.2.patch | 41 ++++++
vsock-11.1.2-4.2.patch | 120 +++++++++++++++++
6 files changed, 667 insertions(+), 2 deletions(-)
create mode 100644 vmblock-11.1.2-4.2.patch
create mode 100644 vmci-11.1.2-4.2.patch
create mode 100644 vmmon-11.1.2-4.2.patch
create mode 100644 vmnet-11.1.2-4.2.patch
create mode 100644 vsock-11.1.2-4.2.patch
diff --git a/PKGBUILD b/PKGBUILD
index 4340a4b..64de144 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -29,7 +29,12 @@ source=('vmware-patch.sh' 'vmware-unpatch.sh' 'common-functions.sh' 'vmware.serv
'vmnet-10.0.4-3.14.patch'
'vsock-10.0.4-3.14.patch'
# Workstation 10.0.1 / Player (Plus) 6.0.1
- 'vmnet-10.0.1-3.13.patch')
+ 'vmnet-10.0.1-3.13.patch'
+ 'vmblock-11.1.2-4.2.patch'
+ 'vmci-11.1.2-4.2.patch'
+ 'vmnet-11.1.2-4.2.patch'
+ 'vsock-11.1.2-4.2.patch'
+ 'vmmon-11.1.2-4.2.patch')
package() {
# Patch scripts
@@ -68,4 +73,9 @@ md5sums=('1fe73e49d253eeba8be2c9d066cf42cb'
'4eca49060d2373c259a0c045520de9f9'
'acd25c0daccb62af8abf750e6369ae25'
'86a889febd9bdf88e458244195d604a4'
- 'd980b5092aeee55edc6dbafb843d886f')
+ 'd980b5092aeee55edc6dbafb843d886f'
+ '36727e319ce5379e5227f618401fd313'
+ '133f3ba5c19ceb00a4ae8f44dc08352a'
+ '2c1d8433b698376c228e650741ba6be5'
+ 'f485b33c2e0808c6a4936c0d0342550a'
+ '905d6daa87b314e541eec00ca4f927c6')
diff --git a/vmblock-11.1.2-4.2.patch b/vmblock-11.1.2-4.2.patch
new file mode 100644
index 0000000..59b2224
--- /dev/null
+++ b/vmblock-11.1.2-4.2.patch
@@ -0,0 +1,339 @@
+diff -ur a/vmblock-only/linux/control.c b/vmblock-only/linux/control.c
+--- vmblock-only/linux/control.c 2015-05-31 16:01:25.000000000 +0300
++++ vmblock-only/linux/control.c 2015-08-08 00:23:51.000000000 +0300
+@@ -208,9 +208,11 @@
+ VMBlockSetProcEntryOwner(controlProcMountpoint);
+
+ /* Create /proc/fs/vmblock/dev */
+- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
+- VMBLOCK_CONTROL_MODE,
+- controlProcDirEntry);
++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME,
++ VMBLOCK_CONTROL_MODE,
++ controlProcDirEntry,
++ &ControlFileOps);
++
+ if (!controlProcEntry) {
+ Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n");
+ remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry);
+@@ -218,7 +220,10 @@
+ return -EINVAL;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ controlProcEntry->proc_fops = &ControlFileOps;
++#endif
++
+ return 0;
+ }
+
+@@ -272,17 +277,44 @@
+ *----------------------------------------------------------------------------
+ */
+
++/* copy-paste from Lustre FS by pavlinux */
++static char *ll_getname(const char __user *filename)
++{
++ int ret = 0, len;
++ char *tmp = __getname();
++
++ if (!tmp)
++ return ERR_PTR(-ENOMEM);
++
++ len = strncpy_from_user(tmp, filename, PATH_MAX);
++ if (len == 0)
++ ret = -ENOENT;
++ else if (len > PATH_MAX)
++ ret = -ENAMETOOLONG;
++
++ if (ret) {
++ __putname(tmp);
++ tmp = ERR_PTR(ret);
++ }
++ return tmp;
++}
++
+ static int
+ ExecuteBlockOp(const char __user *buf, // IN: buffer with name
+ const os_blocker_id_t blocker, // IN: blocker ID (file)
+ int (*blockOp)(const char *filename, // IN: block operation
+ const os_blocker_id_t blocker))
+ {
+- char *name;
++ struct filename *fn = NULL;
++ char *name = (char *)fn->name;
+ int i;
+ int retval;
+
+- name = getname(buf);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
++ name = (char *)getname(buf);
++#else
++ name = (char *)ll_getname(buf);
++#endif
+ if (IS_ERR(name)) {
+ return PTR_ERR(name);
+ }
+@@ -293,7 +325,12 @@
+
+ retval = i < 0 ? -EINVAL : blockOp(name, blocker);
+
+- putname(name);
++ if (fn->name != fn->iname) { /* add by pavlinux */
++ __putname(fn->name);
++ kvfree(fn);
++ } else {
++ __putname(fn);
++ }
+
+ return retval;
+ }
+diff -ur a/vmblock-only/linux/dentry.c b/vmblock-only/linux/dentry.c
+--- vmblock-only/linux/dentry.c 2015-05-31 16:01:25.000000000 +0300
++++ vmblock-only/linux/dentry.c 2015-02-24 03:58:06.000000000 +0300
+@@ -32,7 +32,11 @@
+ #include "block.h"
+
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd);
++#else
++static int DentryOpRevalidate(struct dentry *dentry, unsigned int);
++#endif
+
+ struct dentry_operations LinkDentryOps = {
+ .d_revalidate = DentryOpRevalidate,
+@@ -58,9 +62,12 @@
+ *----------------------------------------------------------------------------
+ */
+
+-static int
+-DentryOpRevalidate(struct dentry *dentry, // IN: dentry revalidating
+- struct nameidata *nd) // IN: lookup flags & intent
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
++static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd)
++#else
++static int DentryOpRevalidate(struct dentry *dentry, unsigned int flags)
++#endif
++
+ {
+ VMBlockInodeInfo *iinfo;
+ struct nameidata actualNd;
+@@ -101,7 +108,11 @@
+ if (actualDentry &&
+ actualDentry->d_op &&
+ actualDentry->d_op->d_revalidate) {
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 14, 0)
++ return actualDentry->d_op->d_revalidate(actualDentry, flags);
++#else
+ return actualDentry->d_op->d_revalidate(actualDentry, nd);
++#endif
+ }
+
+ if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
+diff -ur a/vmblock-only/linux/file.c b/vmblock-only/linux/file.c
+--- vmblock-only/linux/file.c 2015-05-31 16:01:25.000000000 +0300
++++ vmblock-only/linux/file.c 2015-02-24 03:58:06.000000000 +0300
+@@ -38,6 +38,7 @@
+ typedef ino_t inode_num_t;
+ #endif
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ /* Specifically for our filldir_t callback */
+ typedef struct FilldirInfo {
+ filldir_t filldir;
+@@ -76,7 +77,7 @@
+ /* Specify DT_LNK regardless */
+ return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
+ }
+-
++#endif
+
+ /* File operations */
+
+@@ -132,7 +133,7 @@
+ * and that would try to acquire the inode's semaphore; if the two inodes
+ * are the same we'll deadlock.
+ */
+- if (actualFile->f_dentry && inode == actualFile->f_dentry->d_inode) {
++ if (actualFile->f_path.dentry && inode == actualFile->f_path.dentry->d_inode) {
+ Warning("FileOpOpen: identical inode encountered, open cannot succeed.\n");
+ if (filp_close(actualFile, current->files) < 0) {
+ Warning("FileOpOpen: unable to close opened file.\n");
+@@ -164,6 +165,7 @@
+ *----------------------------------------------------------------------------
+ */
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ static int
+ FileOpReaddir(struct file *file, // IN
+ void *dirent, // IN
+@@ -193,7 +195,7 @@
+
+ return ret;
+ }
+-
++#endif
+
+ /*
+ *----------------------------------------------------------------------------
+@@ -237,7 +239,11 @@
+
+
+ struct file_operations RootFileOps = {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ .readdir = FileOpReaddir,
++#endif
++ .owner = THIS_MODULE,
++ .llseek = no_llseek,
+ .open = FileOpOpen,
+ .release = FileOpRelease,
+ };
+diff -ur a/vmblock-only/linux/filesystem.c b/vmblock-only/linux/filesystem.c
+--- vmblock-only/linux/filesystem.c 2015-05-31 16:01:25.000000000 +0300
++++ vmblock-only/linux/filesystem.c 2015-02-24 03:58:06.000000000 +0300
+@@ -322,6 +322,7 @@
+ {
+ VMBlockInodeInfo *iinfo;
+ struct inode *inode;
++
+ struct nameidata actualNd;
+
+ ASSERT(sb);
+diff -ur a/vmblock-only/linux/inode.c b/vmblock-only/linux/inode.c
+--- vmblock-only/linux/inode.c 2015-05-31 16:01:25.000000000 +0300
++++ vmblock-only/linux/inode.c 2015-08-08 00:33:22.000000000 +0300
+@@ -35,26 +35,27 @@
+
+
+ /* Inode operations */
+-static struct dentry *InodeOpLookup(struct inode *dir,
+- struct dentry *dentry, struct nameidata *nd);
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
++static struct dentry *InodeOpLookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd);
+ static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int buflen);
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+-static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
+ #else
+-static int InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd);
++static struct dentry *InodeOpLookup(struct inode *, struct dentry *, unsigned int);
++static int InodeOpReadlink(struct dentry *, char __user *, int);
+ #endif
+
++static const char *InodeOpFollowlink(struct dentry *dentry, void **cookie);
++
+
+ struct inode_operations RootInodeOps = {
+ .lookup = InodeOpLookup,
+ };
+
+-static struct inode_operations LinkInodeOps = {
++struct inode_operations LinkInodeOps = {
+ .readlink = InodeOpReadlink,
+ .follow_link = InodeOpFollowlink,
+ };
+
+-
+ /*
+ *----------------------------------------------------------------------------
+ *
+@@ -75,7 +76,11 @@
+ static struct dentry *
+ InodeOpLookup(struct inode *dir, // IN: parent directory's inode
+ struct dentry *dentry, // IN: dentry to lookup
+- struct nameidata *nd) // IN: lookup intent and information
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
++ struct nameidata *nd) // IN: lookup intent and information
++#else
++ unsigned int flags)
++#endif
+ {
+ char *filename;
+ struct inode *inode;
+@@ -135,7 +140,12 @@
+ inode->i_size = INODE_TO_IINFO(inode)->nameLen;
+ inode->i_version = 1;
+ inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ inode->i_uid = inode->i_gid = 0;
++#else
++ inode->i_gid = make_kgid(current_user_ns(), 0);
++ inode->i_uid = make_kuid(current_user_ns(), 0);
++#endif
+ inode->i_op = &LinkInodeOps;
+
+ d_add(dentry, inode);
+@@ -177,7 +187,12 @@
+ return -EINVAL;
+ }
+
+- return vfs_readlink(dentry, buffer, buflen, iinfo->name);
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 99)
++ return vfs_readlink(dentry, buffer, buflen, iinfo->name);
++#else
++ return readlink_copy(buffer, buflen, iinfo->name);
++#endif
++
+ }
+
+
+@@ -198,13 +213,7 @@
+ *----------------------------------------------------------------------------
+ */
+
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+-static void *
+-#else
+-static int
+-#endif
+-InodeOpFollowlink(struct dentry *dentry, // IN : dentry of symlink
+- struct nameidata *nd) // OUT: stores result
++static const char *InodeOpFollowlink(struct dentry *dentry, void **cookie)
+ {
+ int ret;
+ VMBlockInodeInfo *iinfo;
+@@ -221,7 +230,11 @@
+ goto out;
+ }
+
+- ret = vfs_follow_link(nd, iinfo->name);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
++ return *cookie = (char *)(iinfo->name);
++#else
++ nd_set_link(nd, iinfo->name);
++#endif
+
+ out:
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+@@ -230,3 +243,4 @@
+ return ret;
+ #endif
+ }
++
+Только в a/vmblock-only/shared/autoconf: dalias.c
+Только в a/vmblock-only/shared/autoconf: truncate_pagecache.c
+diff -ur a/vmblock-only/shared/compat_namei.h b/vmblock-only/shared/compat_namei.h
+--- vmblock-only/shared/compat_namei.h 2015-05-31 16:01:25.000000000 +0300
++++ vmblock-only/shared/compat_namei.h 2015-02-24 03:51:25.000000000 +0300
+@@ -21,6 +21,20 @@
+
+ #include <linux/namei.h>
+
++/* Copy-n-paste from kernel's source/fs/namei.c */
++struct nameidata {
++ struct path path;
++ struct qstr last;
++ struct path root;
++ struct inode *inode; /* path.dentry.d_inode */
++ unsigned int flags;
++ unsigned seq, m_seq;
++ int last_type;
++ unsigned depth;
++ struct file *base;
++ char *saved_names[MAX_NESTED_LINKS + 1];
++};
++
+ /*
+ * In 2.6.25-rc2, dentry and mount objects were removed from the nameidata
+ * struct. They were both replaced with a struct path.
diff --git a/vmci-11.1.2-4.2.patch b/vmci-11.1.2-4.2.patch
new file mode 100644
index 0000000..6b7abd3
--- /dev/null
+++ b/vmci-11.1.2-4.2.patch
@@ -0,0 +1,131 @@
+diff -ur a/vmci-only/linux/driver.c b/vmci-only/linux/driver.c
+--- vmci-only/linux/driver.c 2015-05-31 16:01:25.000000000 +0300
++++ vmci-only/linux/driver.c 2015-08-08 00:42:47.000000000 +0300
+@@ -26,13 +26,16 @@
+
+ #include <linux/file.h>
+ #include <linux/fs.h>
++#include <linux/vmalloc.h>
+ #include <linux/init.h>
++
+ #if defined(__x86_64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
+ # include <linux/ioctl32.h>
+ /* Use weak: not all kernels export sys_ioctl for use by modules */
+ asmlinkage __attribute__((weak)) long
+ sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
+ #endif
++
+ #include <linux/miscdevice.h>
+ #include <linux/moduleparam.h>
+ #include <linux/poll.h>
+@@ -713,7 +716,7 @@
+
+ case IOCTL_VMCI_INIT_CONTEXT: {
+ VMCIInitBlock initBlock;
+- VMCIHostUser user;
++ uid_t user;
+
+ retval = copy_from_user(&initBlock, (void *)ioarg, sizeof initBlock);
+ if (retval != 0) {
+@@ -735,7 +738,11 @@
+ goto init_release;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
+ user = current_uid();
++#else
++ user = from_kuid(&init_user_ns, current_uid());
++#endif
+ retval = VMCIContext_InitContext(initBlock.cid, initBlock.flags,
+ 0 /* Unused */, vmciLinux->userVersion,
+ &user, &vmciLinux->context);
+@@ -1683,7 +1690,7 @@
+ /* This should be last to make sure we are done initializing. */
+ retval = pci_register_driver(&vmci_driver);
+ if (retval < 0) {
+- vfree(data_buffer);
++ kvfree(data_buffer);
+ data_buffer = NULL;
+ return retval;
+ }
+@@ -2470,7 +2477,7 @@
+
+ if (guestDeviceInit) {
+ pci_unregister_driver(&vmci_driver);
+- vfree(data_buffer);
++ kvfree(data_buffer);
+ guestDeviceInit = FALSE;
+ }
+
+diff -ur a/vmci-only/linux/vmciKernelIf.c b/vmci-only/linux/vmciKernelIf.c
+--- vmci-only/linux/vmciKernelIf.c 2015-05-31 16:01:25.000000000 +0300
++++ vmci-only/linux/vmciKernelIf.c 2015-02-24 03:58:06.000000000 +0300
+@@ -40,6 +40,7 @@
+ #include <linux/socket.h> /* For memcpy_{to,from}iovec(). */
+ #include <linux/vmalloc.h>
+ #include <linux/wait.h>
++#include <linux/skbuff.h>
+
+ #include "compat_highmem.h"
+ #include "compat_interrupt.h"
+@@ -1196,21 +1197,21 @@
+ } else {
+ toCopy = size - bytesCopied;
+ }
+-
++ /* Code cloned from kernels drivers/misc/vmw_vmci/vmci_queue_pair.c */
+ if (isIovec) {
+- struct iovec *iov = (struct iovec *)src;
+- int err;
++ struct msghdr *msg = (struct msghdr *)src;
++ int err;
+
+- /* The iovec will track bytesCopied internally. */
+- err = memcpy_fromiovec((uint8 *)va + pageOffset, iov, toCopy);
+- if (err != 0) {
+- if (kernelIf->host) {
+- kunmap(kernelIf->u.h.page[pageIndex]);
++ /* The iovec will track bytes_copied internally. */
++ err = memcpy_from_msg((u8 *)va + pageOffset, msg, toCopy);
++ if (err != 0) {
++ if (kernelIf->host)
++ kunmap(kernelIf->u.h.page[pageIndex]);
++ return VMCI_ERROR_INVALID_ARGS;
+ }
+- return VMCI_ERROR_INVALID_ARGS;
+- }
+- } else {
+- memcpy((uint8 *)va + pageOffset, (uint8 *)src + bytesCopied, toCopy);
++ } else {
++ memcpy((u8 *)va + pageOffset,
++ (u8 *)src + bytesCopied, toCopy);
+ }
+
+ bytesCopied += toCopy;
+@@ -1273,11 +1274,11 @@
+ }
+
+ if (isIovec) {
+- struct iovec *iov = (struct iovec *)dest;
++ struct msghdr *msg = (struct msghdr *)dest;
+ int err;
+
+ /* The iovec will track bytesCopied internally. */
+- err = memcpy_toiovec(iov, (uint8 *)va + pageOffset, toCopy);
++ err = memcpy_to_msg(msg, (uint8 *)va + pageOffset, toCopy);
+ if (err != 0) {
+ if (kernelIf->host) {
+ kunmap(kernelIf->u.h.page[pageIndex]);
+diff -ur a/vmci-only/shared/vm_device_version.h b/vmci-only/shared/vm_device_version.h
+--- vmci-only/shared/vm_device_version.h 2015-05-31 16:01:26.000000000 +0300
++++ vmci-only/shared/vm_device_version.h 2015-02-24 03:58:06.000000000 +0300
+@@ -53,7 +53,9 @@
+ * VMware HD Audio codec
+ * VMware HD Audio controller
+ */
++#ifndef PCI_VENDOR_ID_VMWARE
+ #define PCI_VENDOR_ID_VMWARE 0x15AD
++#endif
+ #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
+ #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
+ #define PCI_DEVICE_ID_VMWARE_VGA 0x0711
diff --git a/vmmon-11.1.2-4.2.patch b/vmmon-11.1.2-4.2.patch
new file mode 100644
index 0000000..eb72a3f
--- /dev/null
+++ b/vmmon-11.1.2-4.2.patch
@@ -0,0 +1,24 @@
+diff -ur a/vmmon-only/linux/driver.c b/vmmon-only/linux/driver.c
+--- vmmon-only/linux/driver.c 2015-05-31 16:40:39.000000000 +0300
++++ vmmon-only/linux/driver.c 2015-08-07 05:30:27.000000000 +0300
+@@ -1328,7 +1328,7 @@
+ *-----------------------------------------------------------------------------
+ */
+
+-__attribute__((always_inline)) static Bool
++inline static Bool
+ LinuxDriverSyncReadTSCs(uint64 *delta) // OUT: TSC max - TSC min
+ {
+ TSCDelta tscDelta;
+diff -ur a/vmmon-only/linux/vmmonInt.h b/vmmon-only/linux/vmmonInt.h
+--- vmmon-only/linux/vmmonInt.h 2015-05-31 16:40:39.000000000 +0300
++++ vmmon-only/linux/vmmonInt.h 2015-08-07 05:29:20.000000000 +0300
+@@ -31,7 +31,7 @@
+ #ifdef VMW_HAVE_SMP_CALL_3ARG
+ #define compat_smp_call_function(fn, info, wait) smp_call_function(fn, info, wait)
+ #else
+-#define compat_smp_call_function(fn, info, wait) smp_call_function(fn, info, 1, wait)
++#define compat_smp_call_function(fn, info, wait) smp_call_function(fn, info, wait)
+ #endif
+
+ /*
diff --git a/vmnet-11.1.2-4.2.patch b/vmnet-11.1.2-4.2.patch
new file mode 100644
index 0000000..c488155
--- /dev/null
+++ b/vmnet-11.1.2-4.2.patch
@@ -0,0 +1,41 @@
+diff -ur a/vmnet-only/vm_device_version.h b/vmnet-only/vm_device_version.h
+--- vmnet-only/vm_device_version.h 2015-05-31 16:40:39.000000000 +0300
++++ vmnet-only/vm_device_version.h 2015-08-07 05:21:33.000000000 +0300
+@@ -53,7 +53,10 @@
+ * VMware HD Audio codec
+ * VMware HD Audio controller
+ */
+-#define PCI_VENDOR_ID_VMWARE 0x15AD
++#ifdef PCI_VENDOR_ID_VMWARE
++ #undef PCI_VENDOR_ID_VMWARE
++ #define PCI_VENDOR_ID_VMWARE 0x15AD
++#endif
+ #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
+ #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
+ #define PCI_DEVICE_ID_VMWARE_VGA 0x0711
+diff -ur a/vmnet-only/vmnetInt.h b/vmnet-only/vmnetInt.h
+--- vmnet-only/vmnetInt.h 2015-05-31 16:40:39.000000000 +0300
++++ vmnet-only/vmnetInt.h 2015-08-07 05:19:49.000000000 +0300
+@@ -77,13 +77,18 @@
+
+
+ extern struct proto vmnet_proto;
++
+ #ifdef VMW_NETDEV_HAS_NET
+-# define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
+- PF_NETLINK, _pri, &vmnet_proto)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
++# define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
++ PF_NETLINK, _pri, &vmnet_proto, 1)
+ #else
+-# define compat_sk_alloc(_bri, _pri) sk_alloc(PF_NETLINK, _pri, &vmnet_proto, 1)
++# define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
++ PF_NETLINK, _pri, &vmnet_proto)
++#endif
++#else
++# define compat_sk_alloc(_bri, _pri) sk_alloc(PF_NETLINK, _pri, &vmnet_proto, 1)
+ #endif
+-
+
+ #ifdef NF_IP_LOCAL_IN
+ #define VMW_NF_INET_LOCAL_IN NF_IP_LOCAL_IN
diff --git a/vsock-11.1.2-4.2.patch b/vsock-11.1.2-4.2.patch
new file mode 100644
index 0000000..23cda80
--- /dev/null
+++ b/vsock-11.1.2-4.2.patch
@@ -0,0 +1,120 @@
+diff -ur a/vsock-only/linux/af_vsock.c b/vsock-only/linux/af_vsock.c
+--- vsock-only/linux/af_vsock.c 2015-05-31 16:01:26.000000000 +0300
++++ vsock-only/linux/af_vsock.c 2015-08-07 05:26:39.000000000 +0300
+@@ -2826,7 +2826,9 @@
+ * network namespace, and the option to zero the sock was dropped.
+ *
+ */
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
++ sk = sk_alloc(net, vsockVmciFamilyOps.family, priority, &vsockVmciProto, 1);
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
+ sk = sk_alloc(vsockVmciFamilyOps.family, priority,
+ vsockVmciProto.slab_obj_size, vsockVmciProto.slab);
+ #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
+@@ -4302,7 +4304,7 @@
+ goto out;
+ }
+
+- memcpy_fromiovec(VMCI_DG_PAYLOAD(dg), msg->msg_iov, len);
++ memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len);
+
+ dg->dst = VMCI_MAKE_HANDLE(remoteAddr->svm_cid, remoteAddr->svm_port);
+ dg->src = VMCI_MAKE_HANDLE(vsk->localAddr.svm_cid, vsk->localAddr.svm_port);
+@@ -4662,7 +4664,7 @@
+ * able to send.
+ */
+
+- written = vmci_qpair_enquev(vsk->qpair, msg->msg_iov,
++ written = vmci_qpair_enquev(vsk->qpair, &msg->msg_iter.iov,
+ len - totalWritten, 0);
+ if (written < 0) {
+ err = -ENOMEM;
+@@ -4721,6 +4723,7 @@
+ VMCIDatagram *dg;
+ size_t payloadLen;
+ struct sk_buff *skb;
++ struct iov_iter to;
+
+ sk = sock->sk;
+ noblock = flags & MSG_DONTWAIT;
+@@ -4759,7 +4762,9 @@
+ }
+
+ /* Place the datagram payload in the user's iovec. */
+- err = skb_copy_datagram_iovec(skb, sizeof *dg, msg->msg_iov, payloadLen);
++ // err = skb_copy_datagram_iovec(skb, sizeof *dg, msg->msg_iter, payloadLen);
++ iov_iter_init(&to, READ, (struct iovec *)&msg->msg_iter.iov, 1, payloadLen);
++ err = skb_copy_datagram_iter(skb, 0, &to, payloadLen);
+ if (err) {
+ goto out;
+ }
+@@ -4905,9 +4910,9 @@
+ }
+
+ if (flags & MSG_PEEK) {
+- read = vmci_qpair_peekv(vsk->qpair, msg->msg_iov, len - copied, 0);
++ read = vmci_qpair_peekv(vsk->qpair, &msg->msg_iter.iov, len - copied, 0);
+ } else {
+- read = vmci_qpair_dequev(vsk->qpair, msg->msg_iov, len - copied, 0);
++ read = vmci_qpair_dequev(vsk->qpair, &msg->msg_iter.iov, len - copied, 0);
+ }
+
+ if (read < 0) {
+diff -ur a/vsock-only/linux/notify.c b/vsock-only/linux/notify.c
+--- vsock-only/linux/notify.c 2015-05-31 16:01:26.000000000 +0300
++++ vsock-only/linux/notify.c 2015-02-24 01:09:40.000000000 +0300
+@@ -516,7 +516,7 @@
+ PKT_FIELD(vsk, sentWaitingRead) = FALSE;
+ #endif
+
+- sk->sk_data_ready(sk, 0);
++ sk->sk_data_ready(sk);
+ }
+
+
+diff -ur a/vsock-only/linux/notifyQState.c b/vsock-only/linux/notifyQState.c
+--- vsock-only/linux/notifyQState.c 2015-05-31 16:01:26.000000000 +0300
++++ vsock-only/linux/notifyQState.c 2015-02-24 01:09:40.000000000 +0300
+@@ -164,7 +164,7 @@
+ struct sockaddr_vm *dst, // IN: unused
+ struct sockaddr_vm *src) // IN: unused
+ {
+- sk->sk_data_ready(sk, 0);
++ sk->sk_data_ready(sk);
+ }
+
+
+@@ -566,7 +566,7 @@
+ }
+
+ /* See the comment in VSockVmciNotifyPktSendPostEnqueue */
+- sk->sk_data_ready(sk, 0);
++ sk->sk_data_ready(sk);
+ }
+
+ return err;
+diff -ur a/vsock-only/Makefile b/vsock-only/Makefile
+--- vsock-only/Makefile 2015-05-31 16:01:25.000000000 +0300
++++ vsock-only/Makefile 2015-02-24 01:09:40.000000000 +0300
+@@ -131,7 +131,7 @@
+ > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
+
+ CC_WARNINGS := -Wall -Wstrict-prototypes
+-CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
++CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD -g0
+ ifdef VMX86_DEVEL
+ CC_OPTS += -DVMX86_DEVEL
+ endif
+diff -ur a/vsock-only/shared/vmci_kernel_if.h b/vsock-only/shared/vmci_kernel_if.h
+--- vsock-only/shared/vmci_kernel_if.h 2015-05-31 16:01:26.000000000 +0300
++++ vsock-only/shared/vmci_kernel_if.h 2015-02-24 02:51:12.000000000 +0300
+@@ -102,7 +102,7 @@
+ typedef struct semaphore VMCIMutex;
+ typedef PPN *VMCIPpnList; /* List of PPNs in produce/consume queue. */
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
+- typedef kuid_t VMCIHostUser;
++ typedef uid_t VMCIHostUser;
+ #else
+ typedef uid_t VMCIHostUser;
+ #endif
--
2.6.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment