summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Teran <evan.teran@gmail.com>2014-10-09 16:17:17 -0400
committerEvan Teran <evan.teran@gmail.com>2014-10-09 16:17:17 -0400
commit4d9b602206d7e267af066b17f437934479b36ac0 (patch)
tree588e921658f00f188ca5e103403e9e59db4b53c0 /app-emulation/vmware-modules
parentDropped vmware-modules, identical to main tree (diff)
downloadvmware-4d9b602206d7e267af066b17f437934479b36ac0.tar.gz
vmware-4d9b602206d7e267af066b17f437934479b36ac0.tar.bz2
vmware-4d9b602206d7e267af066b17f437934479b36ac0.zip
doing an initial commit which should patch and compile correctly for 3.10 kernels as a test run
Diffstat (limited to 'app-emulation/vmware-modules')
-rw-r--r--app-emulation/vmware-modules/files/271-3.10-00-userns.patch37
-rw-r--r--app-emulation/vmware-modules/files/271-3.10-01-create_proc_entry.patch24
-rw-r--r--app-emulation/vmware-modules/files/271-3.10-02-getname.patch19
-rw-r--r--app-emulation/vmware-modules/files/271-3.10-03-deprecated.patch90
-rw-r--r--app-emulation/vmware-modules/files/271-apic.patch12
-rw-r--r--app-emulation/vmware-modules/files/271-hardened.patch170
-rw-r--r--app-emulation/vmware-modules/files/271-makefile-include.patch65
-rw-r--r--app-emulation/vmware-modules/files/271-makefile-kernel-dir.patch85
-rw-r--r--app-emulation/vmware-modules/files/271-netdevice.patch24
-rw-r--r--app-emulation/vmware-modules/files/271-putname.patch13
-rw-r--r--app-emulation/vmware-modules/metadata.xml13
-rw-r--r--app-emulation/vmware-modules/vmware-modules-271.3-r1.ebuild87
12 files changed, 639 insertions, 0 deletions
diff --git a/app-emulation/vmware-modules/files/271-3.10-00-userns.patch b/app-emulation/vmware-modules/files/271-3.10-00-userns.patch
new file mode 100644
index 0000000..c960b78
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-3.10-00-userns.patch
@@ -0,0 +1,37 @@
+--- a/vmblock-only/linux/inode.c 2013-03-20 17:37:48.000000000 +0100
++++ b/vmblock-only/linux/inode.c 2013-03-20 17:41:22.000000000 +0100
+@@ -135,7 +135,8 @@
+ inode->i_size = INODE_TO_IINFO(inode)->nameLen;
+ inode->i_version = 1;
+ inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+- inode->i_uid = inode->i_gid = 0;
++ inode->i_uid = GLOBAL_ROOT_UID;
++ inode->i_gid = GLOBAL_ROOT_GID;
+ inode->i_op = &LinkInodeOps;
+
+ d_add(dentry, inode);
+
+--- a/vmci-only/linux/driver.c 2013-03-20 17:57:35.000000000 +0100
++++ b/vmci-only/linux/driver.c 2013-03-20 17:57:43.000000000 +0100
+@@ -740,7 +740,7 @@
+ goto init_release;
+ }
+
+- user = current_uid();
++ user = from_kuid(current_user_ns(), current_uid());
+ retval = VMCIContext_InitContext(initBlock.cid, initBlock.flags,
+ 0 /* Unused */, vmciLinux->userVersion,
+ &user, &vmciLinux->context);
+
+--- a/vsock-only/linux/af_vsock.c 2013-03-20 18:01:48.000000000 +0100
++++ b/vsock-only/linux/af_vsock.c 2013-03-20 18:01:58.000000000 +0100
+@@ -2866,7 +2866,7 @@
+ vsk->connectTimeout = psk->connectTimeout;
+ } else {
+ vsk->trusted = capable(CAP_NET_ADMIN);
+- vsk->owner = current_uid();
++ vsk->owner = from_kuid(current_user_ns(), current_uid());
+ vsk->queuePairSize = VSOCK_DEFAULT_QP_SIZE;
+ vsk->queuePairMinSize = VSOCK_DEFAULT_QP_SIZE_MIN;
+ vsk->queuePairMaxSize = VSOCK_DEFAULT_QP_SIZE_MAX;
+
diff --git a/app-emulation/vmware-modules/files/271-3.10-01-create_proc_entry.patch b/app-emulation/vmware-modules/files/271-3.10-01-create_proc_entry.patch
new file mode 100644
index 0000000..85c3def
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-3.10-01-create_proc_entry.patch
@@ -0,0 +1,24 @@
+--- a/vmblock-only/linux/control.c 2013-05-21 19:21:19.165750556 +0200
++++ b/vmblock-only/linux/control.c 2013-05-21 19:22:18.363747723 +0200
+@@ -208,9 +208,10 @@
+ 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 +219,6 @@
+ return -EINVAL;
+ }
+
+- controlProcEntry->proc_fops = &ControlFileOps;
+ return 0;
+ }
+
diff --git a/app-emulation/vmware-modules/files/271-3.10-02-getname.patch b/app-emulation/vmware-modules/files/271-3.10-02-getname.patch
new file mode 100644
index 0000000..7bcf536
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-3.10-02-getname.patch
@@ -0,0 +1,19 @@
+--- vmblock-only/linux/control.c 2014-03-15 15:28:40.871076076 +0100
++++ vmblock-only/linux/control.c.new 2014-03-15 15:29:15.079074439 +0100
+@@ -279,11 +279,17 @@
+ int i;
+ int retval;
+
+- name = getname(buf);
++ name = __getname();
+ if (IS_ERR(name)) {
+ return PTR_ERR(name);
+ }
+
++ i = strncpy_from_user(name, buf, PATH_MAX);
++ if (i < 0 || i == PATH_MAX) {
++ __putname(name);
++ return -EINVAL;
++ }
++
+ for (i = strlen(name) - 1; i >= 0 && name[i] == '/'; i--) {
diff --git a/app-emulation/vmware-modules/files/271-3.10-03-deprecated.patch b/app-emulation/vmware-modules/files/271-3.10-03-deprecated.patch
new file mode 100644
index 0000000..862ef97
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-3.10-03-deprecated.patch
@@ -0,0 +1,90 @@
+diff -rupN vmblock-only/shared/vm_assert.h vmblock-only.new/shared/vm_assert.h
+--- vmblock-only/shared/vm_assert.h 2013-11-05 23:33:27.000000000 -0500
++++ vmblock-only.new/shared/vm_assert.h 2014-10-07 18:13:59.583815971 -0400
+@@ -237,12 +237,12 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define LOG_ONCE(_s) DO_ONCE(Log _s)
+
+ #ifdef VMX86_DEVEL
+- #define DEPRECATED(_fix) DO_ONCE( \
++ #define VMWARE_DEPRECATED(_fix) DO_ONCE( \
+ Warning("%s:%d: %s is DEPRECATED; %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, \
+ _fix))
+ #else
+- #define DEPRECATED(_fix) do {} while (0)
++ #define VMWARE_DEPRECATED(_fix) do {} while (0)
+ #endif
+
+
+diff -rupN vmci-only/shared/vm_assert.h vmci-only.new/shared/vm_assert.h
+--- vmci-only/shared/vm_assert.h 2013-11-05 23:33:27.000000000 -0500
++++ vmci-only.new/shared/vm_assert.h 2014-10-07 18:14:18.470816995 -0400
+@@ -237,12 +237,12 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define LOG_ONCE(_s) DO_ONCE(Log _s)
+
+ #ifdef VMX86_DEVEL
+- #define DEPRECATED(_fix) DO_ONCE( \
++ #define VMWARE_DEPRECATED(_fix) DO_ONCE( \
+ Warning("%s:%d: %s is DEPRECATED; %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, \
+ _fix))
+ #else
+- #define DEPRECATED(_fix) do {} while (0)
++ #define VMWARE_DEPRECATED(_fix) do {} while (0)
+ #endif
+
+
+diff -rupN vmmon-only/include/vm_assert.h vmmon-only.new/include/vm_assert.h
+--- vmmon-only/include/vm_assert.h 2013-11-06 00:40:51.000000000 -0500
++++ vmmon-only.new/include/vm_assert.h 2014-10-07 18:14:12.118816650 -0400
+@@ -237,12 +237,12 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define LOG_ONCE(_s) DO_ONCE(Log _s)
+
+ #ifdef VMX86_DEVEL
+- #define DEPRECATED(_fix) DO_ONCE( \
++ #define VMWARE_DEPRECATED(_fix) DO_ONCE( \
+ Warning("%s:%d: %s is DEPRECATED; %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, \
+ _fix))
+ #else
+- #define DEPRECATED(_fix) do {} while (0)
++ #define VMWARE_DEPRECATED(_fix) do {} while (0)
+ #endif
+
+
+diff -rupN vmnet-only/vm_assert.h vmnet-only.new/vm_assert.h
+--- vmnet-only/vm_assert.h 2013-11-06 00:40:52.000000000 -0500
++++ vmnet-only.new/vm_assert.h 2014-10-07 18:14:05.167816273 -0400
+@@ -237,12 +237,12 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define LOG_ONCE(_s) DO_ONCE(Log _s)
+
+ #ifdef VMX86_DEVEL
+- #define DEPRECATED(_fix) DO_ONCE( \
++ #define VMWARE_DEPRECATED(_fix) DO_ONCE( \
+ Warning("%s:%d: %s is DEPRECATED; %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, \
+ _fix))
+ #else
+- #define DEPRECATED(_fix) do {} while (0)
++ #define VMWARE_DEPRECATED(_fix) do {} while (0)
+ #endif
+
+
+diff -rupN vsock-only/shared/vm_assert.h vsock-only.new/shared/vm_assert.h
+--- vsock-only/shared/vm_assert.h 2013-11-05 23:33:27.000000000 -0500
++++ vsock-only.new/shared/vm_assert.h 2014-10-07 18:14:24.454817319 -0400
+@@ -237,12 +237,12 @@ EXTERN void WarningThrottled(uint32 *cou
+ #define LOG_ONCE(_s) DO_ONCE(Log _s)
+
+ #ifdef VMX86_DEVEL
+- #define DEPRECATED(_fix) DO_ONCE( \
++ #define VMWARE_DEPRECATED(_fix) DO_ONCE( \
+ Warning("%s:%d: %s is DEPRECATED; %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, \
+ _fix))
+ #else
+- #define DEPRECATED(_fix) do {} while (0)
++ #define VMWARE_DEPRECATED(_fix) do {} while (0)
+ #endif
+
+
diff --git a/app-emulation/vmware-modules/files/271-apic.patch b/app-emulation/vmware-modules/files/271-apic.patch
new file mode 100644
index 0000000..66cd459
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-apic.patch
@@ -0,0 +1,12 @@
+diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
+index f1f4b10..c43242f 100644
+--- a/vmmon-only/linux/hostif.c
++++ b/vmmon-only/linux/hostif.c
+@@ -55,6 +55,7 @@
+ #include <linux/kthread.h>
+ #include <linux/wait.h>
+
++#include <asm/apic.h>
+
+ #include "vmware.h"
+ #include "x86apic.h"
diff --git a/app-emulation/vmware-modules/files/271-hardened.patch b/app-emulation/vmware-modules/files/271-hardened.patch
new file mode 100644
index 0000000..ea1b0f3
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-hardened.patch
@@ -0,0 +1,170 @@
+diff --git a/vmci-only/linux/driver.c b/vmci-only/linux/driver.c
+index 921f25c..41a39e3 100644
+--- a/vmci-only/linux/driver.c
++++ b/vmci-only/linux/driver.c
+@@ -241,7 +241,24 @@ static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
+ #define LinuxDriverUnlockIoctlPerFD(mutex) do {} while (0)
+ #endif
+
+-static struct file_operations vmuser_fops;
++/*
++ * Moved file operations initialize here because of incompatibilites
++ * with Gentoo hardened profile/hardend Linux 3.
++ */
++static struct file_operations vmuser_fops = {
++ .owner = THIS_MODULE,
++ .poll = LinuxDriverPoll,
++#ifdef HAVE_UNLOCKED_IOCTL
++ .unlocked_ioctl = LinuxDriver_UnlockedIoctl,
++#else
++ .ioctl = LinuxDriver_Ioctl,
++#endif
++#ifdef HAVE_COMPAT_IOCTL
++ .compat_ioctl = LinuxDriver_UnlockedIoctl,
++#endif
++ .open = LinuxDriver_Open,
++ .release = LinuxDriver_Close
++};
+
+
+ /*
+@@ -378,26 +395,6 @@ vmci_host_init(void)
+ return -ENOMEM;
+ }
+
+- /*
+- * Initialize the file_operations structure. Because this code is always
+- * compiled as a module, this is fine to do it here and not in a static
+- * initializer.
+- */
+-
+- memset(&vmuser_fops, 0, sizeof vmuser_fops);
+- vmuser_fops.owner = THIS_MODULE;
+- vmuser_fops.poll = LinuxDriverPoll;
+-#ifdef HAVE_UNLOCKED_IOCTL
+- vmuser_fops.unlocked_ioctl = LinuxDriver_UnlockedIoctl;
+-#else
+- vmuser_fops.ioctl = LinuxDriver_Ioctl;
+-#endif
+-#ifdef HAVE_COMPAT_IOCTL
+- vmuser_fops.compat_ioctl = LinuxDriver_UnlockedIoctl;
+-#endif
+- vmuser_fops.open = LinuxDriver_Open;
+- vmuser_fops.release = LinuxDriver_Close;
+-
+ sprintf(linuxState.deviceName, "vmci");
+ linuxState.major = 10;
+ linuxState.misc.minor = MISC_DYNAMIC_MINOR;
+diff --git a/vmmon-only/linux/driver.c b/vmmon-only/linux/driver.c
+index b21dd44..960c2aa 100644
+--- a/vmmon-only/linux/driver.c
++++ b/vmmon-only/linux/driver.c
+@@ -178,7 +178,22 @@ static struct vm_operations_struct vmuser_mops = {
+ #endif
+ };
+
+-static struct file_operations vmuser_fops;
++static struct file_operations vmuser_fops = {
++ .owner = THIS_MODULE,
++ .poll = LinuxDriverPoll,
++#ifdef HAVE_UNLOCKED_IOCTL
++ .unlocked_ioctl = LinuxDriver_UnlockedIoctl,
++#else
++ .ioctl = LinuxDriver_Ioctl,
++#endif
++#ifdef HAVE_COMPAT_IOCTL
++ .compat_ioctl = LinuxDriver_UnlockedIoctl,
++#endif
++ .open = LinuxDriver_Open,
++ .release = LinuxDriver_Close,
++ .mmap = LinuxDriverMmap
++};
++
+ static struct timer_list tscTimer;
+
+ /*
+@@ -357,27 +372,6 @@ init_module(void)
+ spin_lock_init(&linuxState.pollListLock);
+ #endif
+
+- /*
+- * Initialize the file_operations structure. Because this code is always
+- * compiled as a module, this is fine to do it here and not in a static
+- * initializer.
+- */
+-
+- memset(&vmuser_fops, 0, sizeof vmuser_fops);
+- vmuser_fops.owner = THIS_MODULE;
+- vmuser_fops.poll = LinuxDriverPoll;
+-#ifdef HAVE_UNLOCKED_IOCTL
+- vmuser_fops.unlocked_ioctl = LinuxDriver_UnlockedIoctl;
+-#else
+- vmuser_fops.ioctl = LinuxDriver_Ioctl;
+-#endif
+-#ifdef HAVE_COMPAT_IOCTL
+- vmuser_fops.compat_ioctl = LinuxDriver_UnlockedIoctl;
+-#endif
+- vmuser_fops.open = LinuxDriver_Open;
+- vmuser_fops.release = LinuxDriver_Close;
+- vmuser_fops.mmap = LinuxDriverMmap;
+-
+ #ifdef VMX86_DEVEL
+ devel_init_module();
+ linuxState.minor = 0;
+diff --git a/vmnet-only/driver.c b/vmnet-only/driver.c
+index b12b982..40bd4cf 100644
+--- a/vmnet-only/driver.c
++++ b/vmnet-only/driver.c
+@@ -165,7 +165,22 @@ static long VNetFileOpUnlockedIoctl(struct file * filp,
+ unsigned int iocmd, unsigned long ioarg);
+ #endif
+
+-static struct file_operations vnetFileOps;
++static struct file_operations vnetFileOps = {
++ .owner = THIS_MODULE,
++ .read = VNetFileOpRead,
++ .write = VNetFileOpWrite,
++ .poll = VNetFileOpPoll,
++#ifdef HAVE_UNLOCKED_IOCTL
++ .unlocked_ioctl = VNetFileOpUnlockedIoctl,
++#else
++ .ioctl = VNetFileOpIoctl,
++#endif
++#ifdef HAVE_COMPAT_IOCTL
++ .compat_ioctl = VNetFileOpUnlockedIoctl,
++#endif
++ .open = VNetFileOpOpen,
++ .release = VNetFileOpClose
++};
+
+ /*
+ * Utility functions
+@@ -476,28 +491,6 @@ init_module(void)
+ goto err_proto;
+ }
+
+- /*
+- * Initialize the file_operations structure. Because this code is always
+- * compiled as a module, this is fine to do it here and not in a static
+- * initializer.
+- */
+-
+- memset(&vnetFileOps, 0, sizeof vnetFileOps);
+- vnetFileOps.owner = THIS_MODULE;
+- vnetFileOps.read = VNetFileOpRead;
+- vnetFileOps.write = VNetFileOpWrite;
+- vnetFileOps.poll = VNetFileOpPoll;
+-#ifdef HAVE_UNLOCKED_IOCTL
+- vnetFileOps.unlocked_ioctl = VNetFileOpUnlockedIoctl;
+-#else
+- vnetFileOps.ioctl = VNetFileOpIoctl;
+-#endif
+-#ifdef HAVE_COMPAT_IOCTL
+- vnetFileOps.compat_ioctl = VNetFileOpUnlockedIoctl;
+-#endif
+- vnetFileOps.open = VNetFileOpOpen;
+- vnetFileOps.release = VNetFileOpClose;
+-
+ retval = register_chrdev(VNET_MAJOR_NUMBER, "vmnet", &vnetFileOps);
+ if (retval) {
+ LOG(0, (KERN_NOTICE "/dev/vmnet: could not register major device %d\n",
diff --git a/app-emulation/vmware-modules/files/271-makefile-include.patch b/app-emulation/vmware-modules/files/271-makefile-include.patch
new file mode 100644
index 0000000..39c3000
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-makefile-include.patch
@@ -0,0 +1,65 @@
+diff --git a/vmblock-only/Makefile.kernel b/vmblock-only/Makefile.kernel
+index ab7a727..e3ec9d2 100644
+--- a/vmblock-only/Makefile.kernel
++++ b/vmblock-only/Makefile.kernel
+@@ -19,7 +19,7 @@
+
+ INCLUDE += -I$(SRCROOT)/include
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+
+ EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/cachecreate.c, -DVMW_KMEMCR_HAS_DTOR, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, )
+diff --git a/vmci-only/Makefile.kernel b/vmci-only/Makefile.kernel
+index ba343ee..861ea83 100644
+--- a/vmci-only/Makefile.kernel
++++ b/vmci-only/Makefile.kernel
+@@ -21,7 +21,7 @@ CC_OPTS += -DVMCI
+
+ INCLUDE += -I$(SRCROOT)/shared -I$(SRCROOT)/common -I$(SRCROOT)/linux
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+
+ obj-m += $(DRIVER).o
+
+diff --git a/vmmon-only/Makefile.kernel b/vmmon-only/Makefile.kernel
+index 8770d1d..c4746c3 100644
+--- a/vmmon-only/Makefile.kernel
++++ b/vmmon-only/Makefile.kernel
+@@ -22,7 +22,7 @@ CC_OPTS += -DVMMON -DVMCORE
+ INCLUDE := -I$(SRCROOT)/include -I$(SRCROOT)/common -I$(SRCROOT)/linux \
+ -I$(SRCROOT)/vmcore
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/smpcall.c, -DVMW_HAVE_SMP_CALL_3ARG, )
+
+diff --git a/vmnet-only/Makefile.kernel b/vmnet-only/Makefile.kernel
+index d1e3133..665d428 100644
+--- a/vmnet-only/Makefile.kernel
++++ b/vmnet-only/Makefile.kernel
+@@ -19,7 +19,7 @@
+
+ INCLUDE := -I$(SRCROOT)
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netdev_has_net.c,-DVMW_NETDEV_HAS_NET, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netdev_has_dev_net.c,-DVMW_NETDEV_HAS_DEV_NET, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/nfhook_uses_skb.c,-DVMW_NFHOOK_USES_SKB, )
+diff --git a/vsock-only/Makefile.kernel b/vsock-only/Makefile.kernel
+index b4629ee..264b8cb 100644
+--- a/vsock-only/Makefile.kernel
++++ b/vsock-only/Makefile.kernel
+@@ -25,7 +25,7 @@ INCLUDE += -I$(SRCROOT)/include
+ INCLUDE += -I$(SRCROOT)/linux
+ INCLUDE += -I$(SRCROOT)/common
+
+-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE)
+ EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/netcreate_num_params.c, -DVMW_NETCREATE_KERNARG, )
+
+
diff --git a/app-emulation/vmware-modules/files/271-makefile-kernel-dir.patch b/app-emulation/vmware-modules/files/271-makefile-kernel-dir.patch
new file mode 100644
index 0000000..1a647a3
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-makefile-kernel-dir.patch
@@ -0,0 +1,85 @@
+diff --git a/vmblock-only/Makefile b/vmblock-only/Makefile
+index 2b81323..746c8b8 100644
+--- a/vmblock-only/Makefile
++++ b/vmblock-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vmblock
+ PRODUCT := ws
+diff --git a/vmci-only/Makefile b/vmci-only/Makefile
+index 8e9c5be..6ec828b 100644
+--- a/vmci-only/Makefile
++++ b/vmci-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vmci
+ PRODUCT := ws
+diff --git a/vmmon-only/Makefile b/vmmon-only/Makefile
+index 5bd867b..91a83d4 100644
+--- a/vmmon-only/Makefile
++++ b/vmmon-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vmmon
+ PRODUCT := @@PRODUCT@@
+diff --git a/vmnet-only/Makefile b/vmnet-only/Makefile
+index d4eb73c..c7c6d38 100644
+--- a/vmnet-only/Makefile
++++ b/vmnet-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vmnet
+ PRODUCT := @@PRODUCT@@
+diff --git a/vsock-only/Makefile b/vsock-only/Makefile
+index 93dd61d..9765696 100644
+--- a/vsock-only/Makefile
++++ b/vsock-only/Makefile
+@@ -49,10 +49,10 @@ VM_UNAME = $(shell uname -r)
+ ifdef LINUXINCLUDE
+ HEADER_DIR = $(LINUXINCLUDE)
+ else
+-HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
++HEADER_DIR = $(KERNEL_DIR)
+ endif
+
+-BUILD_DIR = $(HEADER_DIR)/..
++BUILD_DIR = $(KBUILD_OUTPUT)
+
+ DRIVER := vsock
+ PRODUCT := ws
diff --git a/app-emulation/vmware-modules/files/271-netdevice.patch b/app-emulation/vmware-modules/files/271-netdevice.patch
new file mode 100644
index 0000000..35231a3
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-netdevice.patch
@@ -0,0 +1,24 @@
+diff --git a/vmnet-only/compat_netdevice.h b/vmnet-only/compat_netdevice.h
+index 7a56304..9ff4548 100644
+--- a/vmnet-only/compat_netdevice.h
++++ b/vmnet-only/compat_netdevice.h
+@@ -47,6 +47,19 @@
+ # define net_device device
+ #endif
+
++/* it looks like these have been removed from the kernel 3.1
++ * probably because the "transition" is considered complete.
++ * so to keep this source compatible we just redefine them like they were
++ * previously
++ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
++#define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev
++ functions are available. */
++#define HAVE_FREE_NETDEV /* free_netdev() */
++#define HAVE_NETDEV_PRIV /* netdev_priv() */
++#define HAVE_NETIF_QUEUE
++#define HAVE_NET_DEVICE_OPS
++#endif
+
+ /*
+ * SET_MODULE_OWNER appeared sometime during 2.3.x. It was setting
diff --git a/app-emulation/vmware-modules/files/271-putname.patch b/app-emulation/vmware-modules/files/271-putname.patch
new file mode 100644
index 0000000..6e76130
--- /dev/null
+++ b/app-emulation/vmware-modules/files/271-putname.patch
@@ -0,0 +1,13 @@
+diff --git a/vmblock-only/linux/control.c b/vmblock-only/linux/control.c
+index 79716bd..2dd83fe 100644
+--- a/vmblock-only/linux/control.c
++++ b/vmblock-only/linux/control.c
+@@ -293,7 +293,7 @@ ExecuteBlockOp(const char __user *buf, // IN: buffer with name
+
+ retval = i < 0 ? -EINVAL : blockOp(name, blocker);
+
+- putname(name);
++ __putname(name);
+
+ return retval;
+ }
diff --git a/app-emulation/vmware-modules/metadata.xml b/app-emulation/vmware-modules/metadata.xml
new file mode 100644
index 0000000..313c162
--- /dev/null
+++ b/app-emulation/vmware-modules/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>vmware</herd>
+ <longdescription>
+ VMware kernel modules.
+ </longdescription>
+ <use>
+ <flag name="pax_kernel">Apply patch needed for pax enabled kernels</flag>
+ <flag name="vmci">Build the Virtual Machine Communication Interface module; disable this if you want to use the module from the mainline kernel</flag>
+ <flag name="vsock">Build the VMware VMCI transport for Virtual Sockets; disable this if you want to use the module from the mainline kernel</flag>
+ </use>
+</pkgmetadata>
diff --git a/app-emulation/vmware-modules/vmware-modules-271.3-r1.ebuild b/app-emulation/vmware-modules/vmware-modules-271.3-r1.ebuild
new file mode 100644
index 0000000..72b49b0
--- /dev/null
+++ b/app-emulation/vmware-modules/vmware-modules-271.3-r1.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/vmware-modules/vmware-modules-271.3.ebuild,v 1.5 2014/06/09 15:24:07 dilfridge Exp $
+
+EAPI="4"
+
+inherit eutils flag-o-matic linux-info linux-mod user versionator udev
+
+PV_MAJOR=$(get_major_version)
+PV_MINOR=$(get_version_component_range 2)
+
+DESCRIPTION="VMware kernel modules"
+HOMEPAGE="http://www.vmware.com/"
+
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="pax_kernel"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ || ( =app-emulation/vmware-player-5.0.${PV_MINOR}*
+ =app-emulation/vmware-workstation-9.0.${PV_MINOR}* )"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ CONFIG_CHECK="~HIGH_RES_TIMERS"
+ if kernel_is ge 2 6 37 && kernel_is lt 2 6 39; then
+ CONFIG_CHECK="${CONFIG_CHECK} BKL"
+ fi
+
+ linux-info_pkg_setup
+
+ linux-mod_pkg_setup
+
+ VMWARE_GROUP=${VMWARE_GROUP:-vmware}
+
+ VMWARE_MODULE_LIST="vmblock vmci vmmon vmnet vsock"
+ VMWARE_MOD_DIR="${PN}-${PVR}"
+
+ BUILD_TARGETS="auto-build KERNEL_DIR=${KERNEL_DIR} KBUILD_OUTPUT=${KV_OUT_DIR}"
+
+ enewgroup "${VMWARE_GROUP}"
+ filter-flags -mfpmath=sse
+
+ for mod in ${VMWARE_MODULE_LIST}; do
+ MODULE_NAMES="${MODULE_NAMES} ${mod}(misc:${S}/${mod}-only)"
+ done
+}
+
+src_unpack() {
+ cd "${S}"
+ for mod in ${VMWARE_MODULE_LIST}; do
+ tar -xf /opt/vmware/lib/vmware/modules/source/${mod}.tar
+ done
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PV_MAJOR}-makefile-kernel-dir.patch"
+ epatch "${FILESDIR}/${PV_MAJOR}-makefile-include.patch"
+ epatch "${FILESDIR}/${PV_MAJOR}-netdevice.patch"
+ use pax_kernel && epatch "${FILESDIR}/${PV_MAJOR}-hardened.patch"
+ epatch "${FILESDIR}/${PV_MAJOR}-apic.patch"
+ kernel_is ge 3 7 0 && epatch "${FILESDIR}/${PV_MAJOR}-putname.patch"
+
+ kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-271-3.10-00-userns.patch
+ kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-271-3.10-01-create_proc_entry.patch
+ kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-271-3.10-02-getname.patch
+ kernel_is ge 3 10 0 && epatch "${FILESDIR}/${PV_MAJOR}-271-3.10-03-deprecated.patch
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_install() {
+ linux-mod_src_install
+ local udevrules="${T}/60-vmware.rules"
+ cat > "${udevrules}" <<-EOF
+ KERNEL=="vmci", GROUP="vmware", MODE=660
+ KERNEL=="vmmon", GROUP="vmware", MODE=660
+ KERNEL=="vsock", GROUP="vmware", MODE=660
+ EOF
+ udev_dorules "${udevrules}"
+}