diff --git a/app-emulation/vmware-modules/files/279-filldir.patch b/app-emulation/vmware-modules/files/279-filldir.patch new file mode 100644 index 0000000..6eb1f31 --- /dev/null +++ b/app-emulation/vmware-modules/files/279-filldir.patch @@ -0,0 +1,91 @@ +diff --git a/vmblock-only/linux/file.c b/vmblock-only/linux/file.c +index d7ac1f6..5499169 100644 +--- a/vmblock-only/linux/file.c ++++ b/vmblock-only/linux/file.c +@@ -38,46 +38,6 @@ typedef u64 inode_num_t; + typedef ino_t inode_num_t; + #endif + +-/* Specifically for our filldir_t callback */ +-typedef struct FilldirInfo { +- filldir_t filldir; +- void *dirent; +-} FilldirInfo; +- +- +-/* +- *---------------------------------------------------------------------------- +- * +- * Filldir -- +- * +- * Callback function for readdir that we use in place of the one provided. +- * This allows us to specify that each dentry is a symlink, but pass through +- * everything else to the original filldir function. +- * +- * Results: +- * Original filldir's return value. +- * +- * Side effects: +- * Directory information gets copied to user's buffer. +- * +- *---------------------------------------------------------------------------- +- */ +- +-static int +-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir +- const char *name, // IN: Dirent name +- int namelen, // IN: len of dirent's name +- loff_t offset, // IN: Offset +- inode_num_t ino, // IN: Inode number of dirent +- unsigned int d_type) // IN: Type of file +-{ +- FilldirInfo *info = buf; +- +- /* Specify DT_LNK regardless */ +- return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK); +-} +- +- + /* File operations */ + + /* +@@ -166,11 +126,10 @@ FileOpOpen(struct inode *inode, // IN + + static int + FileOpReaddir(struct file *file, // IN +- void *dirent, // IN +- filldir_t filldir) // IN ++ struct dir_context *ctx) // IN + { + int ret; +- FilldirInfo info; ++ + struct file *actualFile; + + if (!file) { +@@ -184,12 +143,10 @@ FileOpReaddir(struct file *file, // IN + return -EINVAL; + } + +- info.filldir = filldir; +- info.dirent = dirent; +- +- actualFile->f_pos = file->f_pos; +- ret = vfs_readdir(actualFile, Filldir, &info); +- file->f_pos = actualFile->f_pos; ++ /* Ricky Wong Yung Fei: ++ * Manipulation of pos is now handled internally by iterate_dir(). ++ */ ++ ret = iterate_dir(actualFile, ctx); + + return ret; + } +@@ -237,7 +194,7 @@ FileOpRelease(struct inode *inode, // IN + + + struct file_operations RootFileOps = { +- .readdir = FileOpReaddir, ++ .iterate = FileOpReaddir, + .open = FileOpOpen, + .release = FileOpRelease, + }; diff --git a/app-emulation/vmware-modules/files/279-vfsfollowlink.patch b/app-emulation/vmware-modules/files/279-vfsfollowlink.patch new file mode 100644 index 0000000..13f600e --- /dev/null +++ b/app-emulation/vmware-modules/files/279-vfsfollowlink.patch @@ -0,0 +1,30 @@ +diff -Naur a/linux/inode.c b/linux/inode.c +--- a/vmblock-only/linux/inode.c 2013-10-03 04:29:47.471339204 -0400 ++++ b/vmblock-only/linux/inode.c 2013-10-03 04:31:56.607334636 -0400 +@@ -36,7 +36,7 @@ + + /* Inode operations */ + static struct dentry *InodeOpLookup(struct inode *dir, +- struct dentry *dentry, struct nameidata *nd); ++ struct dentry *dentry, unsigned int flags); + 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); +@@ -75,7 +75,7 @@ + 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 ++ unsigned int flags) // IN: lookup intent and information + { + char *filename; + struct inode *inode; +@@ -221,7 +221,7 @@ + goto out; + } + +- ret = vfs_follow_link(nd, iinfo->name); ++ nd_set_link(nd, iinfo->name); + + out: + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) diff --git a/app-emulation/vmware-modules/files/hardened.patch b/app-emulation/vmware-modules/files/hardened.patch new file mode 100644 index 0000000..ea1b0f3 --- /dev/null +++ b/app-emulation/vmware-modules/files/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/vmware-modules-279.3.ebuild b/app-emulation/vmware-modules/vmware-modules-279.3.ebuild new file mode 100644 index 0000000..5b83030 --- /dev/null +++ b/app-emulation/vmware-modules/vmware-modules-279.3.ebuild @@ -0,0 +1,101 @@ +# 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-279.3.ebuild,v 1.1 2014/10/16 21:48:57 dilfridge Exp $ + +EAPI=5 + +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 +vmci +vsock" + +RDEPEND="" +DEPEND="${RDEPEND} + || ( =app-emulation/vmware-player-6.0.${PV_MINOR}* + =app-emulation/vmware-workstation-10.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 + if use vmci ; then + CONFIG_CHECK="${CONFIG_CHECK} !VMWARE_VMCI" + else + CONFIG_CHECK="${CONFIG_CHECK} VMWARE_VMCI" + fi + if use vsock ; then + CONFIG_CHECK="${CONFIG_CHECK} !VMWARE_VMCI_VSOCKETS" + else + CONFIG_CHECK="${CONFIG_CHECK} VMWARE_VMCI_VSOCKETS" + fi + + linux-info_pkg_setup + + linux-mod_pkg_setup + + VMWARE_GROUP=${VMWARE_GROUP:-vmware} + + VMWARE_MODULE_LIST_ALL="vmblock vmmon vmnet vmci vsock" + VMWARE_MODULE_LIST="vmblock vmmon vmnet" + use vmci && VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} vmci" + use vsock && VMWARE_MODULE_LIST="${VMWARE_MODULE_LIST} 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_ALL}; 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}/279-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}-vmblock.patch" + kernel_is ge 3 11 0 && epatch "${FILESDIR}/${PV_MAJOR}-filldir.patch" + kernel_is ge 3 12 0 && epatch "${FILESDIR}/${PV_MAJOR}-vfsfollowlink.patch" + kernel_is ge 3 11 0 && epatch "${FILESDIR}/${PV_MAJOR}-userns.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=="vmw_vmci", GROUP="vmware", MODE=660 + KERNEL=="vmmon", GROUP="vmware", MODE=660 + KERNEL=="vsock", GROUP="vmware", MODE=660 + EOF + udev_dorules "${udevrules}" +}