commit:     bf1be07d2a1d9643f2668583694d4a84011bc529
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  8 23:20:59 2016 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb  8 23:21:20 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf1be07d

app-emulation/vmware-modules: Add patches for compilation with Kernel 4.2, bug 
561252

Patches prepared by Ognian Tenchev, original source 
https://communities.vmware.com/thread/517279

Package-Manager: portage-2.2.27

 .../vmware-modules/files/304-4.2-01-inode.patch    | 46 ++++++++++++++++++++
 .../vmware-modules/files/304-4.2-02-vmnetInt.patch | 23 ++++++++++
 .../vmware-modules/files/304-4.2-03-af_vsock.patch | 13 ++++++
 .../vmware-modules/files/304-4.2-04-driver.patch   | 50 ++++++++++++++++++++++
 .../vmware-modules/vmware-modules-304.2.ebuild     |  4 ++
 5 files changed, 136 insertions(+)

diff --git a/app-emulation/vmware-modules/files/304-4.2-01-inode.patch 
b/app-emulation/vmware-modules/files/304-4.2-01-inode.patch
new file mode 100644
index 0000000..35a275b
--- /dev/null
+++ b/app-emulation/vmware-modules/files/304-4.2-01-inode.patch
@@ -0,0 +1,46 @@
+--- vmblock-only/linux/inode.c.orig    2015-09-28 01:11:08.000000000 +0300
++++ vmblock-only/linux/inode.c 2015-09-28 01:14:32.318043465 +0300
+@@ -44,7 +44,9 @@
+ static int InodeOpReadlink(struct dentry *, char __user *, int);
+ #endif
+ 
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
++static const char *InodeOpFollowlink(struct dentry *dentry, void **cookie);
++#elif 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);
+@@ -221,13 +223,15 @@
+  *----------------------------------------------------------------------------
+  */
+ 
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+-static void *
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
++static const char *InodeOpFollowlink(struct dentry *dentry, void **cookie)
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
++static void * InodeOpFollowlink(struct dentry *dentry,  // IN : dentry of 
symlink
++                  struct nameidata *nd)   // OUT: stores result
+ #else
+-static int
+-#endif
+-InodeOpFollowlink(struct dentry *dentry,  // IN : dentry of symlink
++static int InodeOpFollowlink(struct dentry *dentry,  // IN : dentry of symlink
+                   struct nameidata *nd)   // OUT: stores result
++#endif
+ {
+    int ret;
+    VMBlockInodeInfo *iinfo;
+@@ -244,7 +248,11 @@
+       goto out;
+    }
+ 
++#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)

diff --git a/app-emulation/vmware-modules/files/304-4.2-02-vmnetInt.patch 
b/app-emulation/vmware-modules/files/304-4.2-02-vmnetInt.patch
new file mode 100644
index 0000000..11c76d0
--- /dev/null
+++ b/app-emulation/vmware-modules/files/304-4.2-02-vmnetInt.patch
@@ -0,0 +1,23 @@
+--- vmnet-only/vmnetInt.h.orig 2015-05-31 16:40:39.000000000 +0300
++++ vmnet-only/vmnetInt.h      2015-09-28 01:22:01.553054142 +0300
+@@ -78,12 +78,16 @@
+ 
+ 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/app-emulation/vmware-modules/files/304-4.2-03-af_vsock.patch 
b/app-emulation/vmware-modules/files/304-4.2-03-af_vsock.patch
new file mode 100644
index 0000000..6155df4
--- /dev/null
+++ b/app-emulation/vmware-modules/files/304-4.2-03-af_vsock.patch
@@ -0,0 +1,13 @@
+--- vsock-only/linux/af_vsock.c.orig   2015-09-28 01:26:51.354061029 +0300
++++ vsock-only/linux/af_vsock.c        2015-09-28 01:25:11.196058649 +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)

diff --git a/app-emulation/vmware-modules/files/304-4.2-04-driver.patch 
b/app-emulation/vmware-modules/files/304-4.2-04-driver.patch
new file mode 100644
index 0000000..237aa22
--- /dev/null
+++ b/app-emulation/vmware-modules/files/304-4.2-04-driver.patch
@@ -0,0 +1,50 @@
+--- vmci-only/linux/driver.c.orig      2015-09-28 01:33:04.416069896 +0300
++++ vmci-only/linux/driver.c   2015-09-28 01:34:32.814071997 +0300
+@@ -26,6 +26,7 @@
+ 
+ #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>
+@@ -713,7 +714,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) {
+@@ -736,7 +736,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 +1684,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 +2471,7 @@
+ 
+    if (guestDeviceInit) {
+       pci_unregister_driver(&vmci_driver);
+-      vfree(data_buffer);
++      kvfree(data_buffer);
+       guestDeviceInit = FALSE;
+    }
+ 

diff --git a/app-emulation/vmware-modules/vmware-modules-304.2.ebuild 
b/app-emulation/vmware-modules/vmware-modules-304.2.ebuild
index 173592f..cab3284 100644
--- a/app-emulation/vmware-modules/vmware-modules-304.2.ebuild
+++ b/app-emulation/vmware-modules/vmware-modules-304.2.ebuild
@@ -95,6 +95,10 @@ src_prepare() {
        kernel_is ge 3 19 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.19-05-vmci_qpair.patch"
        kernel_is ge 3 19 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.19-06-vsock.patch"
        kernel_is ge 3 19 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-3.19-07-vsock.patch"
+       kernel_is ge 4 2 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.2-01-inode.patch"
+       kernel_is ge 4 2 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.2-02-vmnetInt.patch"
+       kernel_is ge 4 2 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.2-03-af_vsock.patch"
+       kernel_is ge 4 2 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.2-04-driver.patch"
 
        # Allow user patches so they can support RC kernels and whatever else
        epatch_user

Reply via email to