Pavlinux
Enthusiast
Enthusiast

Vmware Workstation 11: Кernel modules for linux 4.2-rc5+

Patched sourses: http://filebin.ca/2BMXIZgMZuZ0/source.tar.xz

Patch in attach

diff -ur a/vmblock-only/linux/control.c b/vmblock-only/linux/control.c

--- a/vmblock-only/linux/control.c 2015-05-31 16:01:25.000000000 +0300

+++ b/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

--- a/vmblock-only/linux/dentry.c 2015-05-31 16:01:25.000000000 +0300

+++ b/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

--- a/vmblock-only/linux/file.c 2015-05-31 16:01:25.000000000 +0300

+++ b/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

--- a/vmblock-only/linux/filesystem.c 2015-05-31 16:01:25.000000000 +0300

+++ b/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

--- a/vmblock-only/linux/inode.c 2015-05-31 16:01:25.000000000 +0300

+++ b/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

--- a/vmblock-only/shared/compat_namei.h 2015-05-31 16:01:25.000000000 +0300

+++ b/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 -ur a/vmci-only/linux/driver.c b/vmci-only/linux/driver.c

--- a/vmci-only/linux/driver.c 2015-05-31 16:01:25.000000000 +0300

+++ b/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

--- a/vmci-only/linux/vmciKernelIf.c 2015-05-31 16:01:25.000000000 +0300

+++ b/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/vmci_kernel_if.h b/vmci-only/shared/vmci_kernel_if.h

--- a/vmci-only/shared/vmci_kernel_if.h 2015-05-31 16:01:26.000000000 +0300

+++ b/vmci-only/shared/vmci_kernel_if.h 2015-02-24 03:58:06.000000000 +0300

@@ -93,7 +93,7 @@

   typedef Semaphore VMCIEvent;

   typedef Semaphore VMCIMutex;

   typedef World_ID VMCIHostVmID;

-  typedef uint32   VMCIHostUser;

+  typedef uint32_t VMCIHostUser;

   typedef PPN *VMCIQPGuestMem;

#elif defined(linux)

   typedef spinlock_t VMCILock;

@@ -117,7 +117,7 @@

   } VMCIEvent;

   typedef IOLock *VMCIMutex;

   typedef void *VMCIPpnList; /* Actually a pointer to the C++ Object IOMemoryDescriptor */

-  typedef uid_t  VMCIHostUser;

+  typedef kuid_t VMCIHostUser;

   typedef VA64 *VMCIQPGuestMem;

#elif defined(_WIN32)

   typedef KSPIN_LOCK VMCILock;

diff -ur a/vmci-only/shared/vm_device_version.h b/vmci-only/shared/vm_device_version.h

--- a/vmci-only/shared/vm_device_version.h 2015-05-31 16:01:26.000000000 +0300

+++ b/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 -ur a/vmmon-only/linux/driver.c b/vmmon-only/linux/driver.c

--- a/vmmon-only/linux/driver.c 2015-05-31 16:40:39.000000000 +0300

+++ b/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

--- a/vmmon-only/linux/vmmonInt.h 2015-05-31 16:40:39.000000000 +0300

+++ b/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 -ur a/vmnet-only/vm_device_version.h b/vmnet-only/vm_device_version.h

--- a/vmnet-only/vm_device_version.h 2015-05-31 16:40:39.000000000 +0300

+++ b/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

--- a/vmnet-only/vmnetInt.h 2015-05-31 16:40:39.000000000 +0300

+++ b/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 -ur a/vsock-only/linux/af_vsock.c b/vsock-only/linux/af_vsock.c

--- a/vsock-only/linux/af_vsock.c 2015-05-31 16:01:26.000000000 +0300

+++ b/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

--- a/vsock-only/linux/notify.c 2015-05-31 16:01:26.000000000 +0300

+++ b/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

--- a/vsock-only/linux/notifyQState.c 2015-05-31 16:01:26.000000000 +0300

+++ b/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

--- a/vsock-only/Makefile 2015-05-31 16:01:25.000000000 +0300

+++ b/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

--- a/vsock-only/shared/vmci_kernel_if.h 2015-05-31 16:01:26.000000000 +0300

+++ b/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

3 Replies
Pavlinux
Enthusiast
Enthusiast

Now tested!

tested.png

diapas0n
Contributor
Contributor

This is awesome, thank you. Works perfectly on:

     4.2-3.dmz.1-liquorix-amd64 #1 ZEN SMP PREEMPT Debian 4.2-6 (2015-10-03) x86_64 GNU/Linux

0 Kudos
psychotux
Contributor
Contributor

How to use this patch? plz help me.. thanks before

0 Kudos