Skip to content

Commit

Permalink
app-emulation/vmware-modules: Updates, adding versions for VMware Wor…
Browse files Browse the repository at this point in the history
…kstation 10 and 11
  • Loading branch information
eteran authored and akhuettel committed Sep 4, 2015
1 parent b6e53d7 commit 96f8da4
Show file tree
Hide file tree
Showing 66 changed files with 2,878 additions and 0 deletions.
41 changes: 41 additions & 0 deletions app-emulation/vmware-modules/files/271-3.10-00-userns.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
correctly initializes UID/GID values
gets UID correctly in light of user namespace API
origionally from https://462666.bugs.gentoo.org/attachment.cgi?id=342888

--- 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;

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
uses the new proc_create function to create /proc entries
instead of create_proc_entry which was deprecated:
https://lkml.org/lkml/2013/4/11/215

--- 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;
}

24 changes: 24 additions & 0 deletions app-emulation/vmware-modules/files/271-3.10-02-getname.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
uses __getname/__putname instead of getname. getname was deprecated
the new code calls __getname (which really is a specific type of
memory allocator, then copies the string safely from user space
into the allocated buffer

--- 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--) {
89 changes: 89 additions & 0 deletions app-emulation/vmware-modules/files/271-3.10-03-deprecated.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
undefines DEPRECATED which is unfortunately also defined (as a string)
in <linux/printk.h>. Realistically, this macro isn't even used, so this
doesn't matter much. But it hushes some very loud warnings.

diff -rupN vmblock-only/shared/vm_assert.h vmblock-only.new/shared/vm_assert.h
--- vmblock-only/shared/vm_assert.h 2014-10-09 21:50:54.221159088 -0400
+++ vmblock-only.new/shared/vm_assert.h 2014-10-09 21:53:04.612166156 -0400
@@ -237,11 +237,13 @@ EXTERN void WarningThrottled(uint32 *cou
#define LOG_ONCE(_s) DO_ONCE(Log _s)

#ifdef VMX86_DEVEL
+ #undef DEPRECATED
#define DEPRECATED(_fix) DO_ONCE( \
Warning("%s:%d: %s is DEPRECATED; %s\n", \
__FILE__, __LINE__, __FUNCTION__, \
_fix))
#else
+ #undef DEPRECATED
#define 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 2014-10-09 21:50:54.222159088 -0400
+++ vmci-only.new/shared/vm_assert.h 2014-10-09 21:52:52.348165492 -0400
@@ -237,11 +237,13 @@ EXTERN void WarningThrottled(uint32 *cou
#define LOG_ONCE(_s) DO_ONCE(Log _s)

#ifdef VMX86_DEVEL
+ #undef DEPRECATED
#define DEPRECATED(_fix) DO_ONCE( \
Warning("%s:%d: %s is DEPRECATED; %s\n", \
__FILE__, __LINE__, __FUNCTION__, \
_fix))
#else
+ #undef DEPRECATED
#define 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 2014-10-09 21:50:54.222159088 -0400
+++ vmmon-only.new/include/vm_assert.h 2014-10-09 21:52:36.877164653 -0400
@@ -237,11 +237,13 @@ EXTERN void WarningThrottled(uint32 *cou
#define LOG_ONCE(_s) DO_ONCE(Log _s)

#ifdef VMX86_DEVEL
+ #undef DEPRECATED
#define DEPRECATED(_fix) DO_ONCE( \
Warning("%s:%d: %s is DEPRECATED; %s\n", \
__FILE__, __LINE__, __FUNCTION__, \
_fix))
#else
+ #undef DEPRECATED
#define DEPRECATED(_fix) do {} while (0)
#endif

diff -rupN vmnet-only/vm_assert.h vmnet-only.new/vm_assert.h
--- vmnet-only/vm_assert.h 2014-10-09 21:50:54.222159088 -0400
+++ vmnet-only.new/vm_assert.h 2014-10-09 21:52:57.736165784 -0400
@@ -237,11 +237,13 @@ EXTERN void WarningThrottled(uint32 *cou
#define LOG_ONCE(_s) DO_ONCE(Log _s)

#ifdef VMX86_DEVEL
+ #undef DEPRECATED
#define DEPRECATED(_fix) DO_ONCE( \
Warning("%s:%d: %s is DEPRECATED; %s\n", \
__FILE__, __LINE__, __FUNCTION__, \
_fix))
#else
+ #undef DEPRECATED
#define 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 2014-10-09 21:50:54.222159088 -0400
+++ vsock-only.new/shared/vm_assert.h 2014-10-09 21:52:45.352165112 -0400
@@ -237,11 +237,13 @@ EXTERN void WarningThrottled(uint32 *cou
#define LOG_ONCE(_s) DO_ONCE(Log _s)

#ifdef VMX86_DEVEL
+ #undef DEPRECATED
#define DEPRECATED(_fix) DO_ONCE( \
Warning("%s:%d: %s is DEPRECATED; %s\n", \
__FILE__, __LINE__, __FUNCTION__, \
_fix))
#else
+ #undef DEPRECATED
#define DEPRECATED(_fix) do {} while (0)
#endif

115 changes: 115 additions & 0 deletions app-emulation/vmware-modules/files/271-3.10-04-unused-typedef.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
hushes warnings about unused typedefs which are part of the "static assert"
technique that the code uses. We simply add an "__attribute__((unused)) to each of them

--- vmblock-only/shared/vm_assert.h 2014-10-07 22:43:39.519402467 -0400
+++ vmblock-only/shared/vm_assert.h 2014-10-07 22:48:01.346409957 -0400
@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
#define ASSERT_ON_COMPILE(e) \
do { \
enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} while (0)


--- vmci-only/shared/vm_assert.h 2014-10-07 22:43:39.519402467 -0400
+++ vmci-only/shared/vm_assert.h 2014-10-07 22:47:51.829409685 -0400
@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
#define ASSERT_ON_COMPILE(e) \
do { \
enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} while (0)


--- vmmon-only/include/vm_assert.h 2014-10-07 22:43:39.520402467 -0400
+++ vmmon-only/include/vm_assert.h 2014-10-07 22:47:39.246409325 -0400
@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
#define ASSERT_ON_COMPILE(e) \
do { \
enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} while (0)


--- vmnet-only/vm_assert.h 2014-10-07 22:43:39.520402467 -0400
+++ vmnet-only/vm_assert.h 2014-10-07 22:47:55.804409799 -0400
@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
#define ASSERT_ON_COMPILE(e) \
do { \
enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} while (0)


--- vsock-only/shared/vm_assert.h 2014-10-07 22:47:11.595408534 -0400
+++ vsock-only/shared/vm_assert.h 2014-10-07 22:45:55.715406363 -0400
@@ -317,7 +317,7 @@ EXTERN void WarningThrottled(uint32 *cou
#define ASSERT_ON_COMPILE(e) \
do { \
enum { AssertOnCompileMisused = ((e) ? 1 : -1) }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} while (0)


--- vsock-only/shared/vm_atomic.h 2013-11-05 23:33:27.000000000 -0500
+++ vsock-only/shared/vm_atomic.h 2014-10-07 22:53:06.024418673 -0400
@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
&& 8 * sizeof (out) == size \
&& 8 * sizeof (cast) == size \
? 1 : -1 }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} \
\
\
--- vmci-only/shared/vm_atomic.h 2013-11-05 23:33:27.000000000 -0500
+++ vmci-only/shared/vm_atomic.h 2014-10-07 22:53:24.873419213 -0400
@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
&& 8 * sizeof (out) == size \
&& 8 * sizeof (cast) == size \
? 1 : -1 }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} \
\
\

--- vmblock-only/shared/vm_atomic.h 2013-11-05 23:33:27.000000000 -0500
+++ vmblock-only/shared/vm_atomic.h 2014-10-07 22:53:31.073419390 -0400
@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
&& 8 * sizeof (out) == size \
&& 8 * sizeof (cast) == size \
? 1 : -1 }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} \
\

--- vmnet-only/vm_atomic.h 2013-11-06 00:40:52.000000000 -0500
+++ vmnet-only/vm_atomic.h 2014-10-07 23:04:50.637438831 -0400
@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
&& 8 * sizeof (out) == size \
&& 8 * sizeof (cast) == size \
? 1 : -1 }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} \
\
\

--- vmmon-only/include/vm_atomic.h 2013-11-06 00:40:52.000000000 -0500
+++ vmmon-only/include/vm_atomic.h 2014-10-07 23:04:50.637438831 -0400
@@ -2394,7 +2394,7 @@ Atomic_TestBit64(Atomic_uint64 *var, //
&& 8 * sizeof (out) == size \
&& 8 * sizeof (cast) == size \
? 1 : -1 }; \
- typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
+ __attribute__((unused)) typedef char AssertOnCompileFailed[AssertOnCompileMisused]; \
} \
\
\
34 changes: 34 additions & 0 deletions app-emulation/vmware-modules/files/271-3.10-05-dentry.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
starting with kernel 3.6, d_revalidate takes an unsigned int "flags"
as the second argument, not a nameidata pointer! see fs/namei.c
for implementation

diff -Naur vmblock-only/linux/dentry.c vmblock-only/linux/dentry.c
--- vmblock-only/linux/dentry.c 2013-11-05 23:33:26.000000000 -0500
+++ vmblock-only/linux/dentry.c 2014-04-26 10:58:03.062635343 -0400
@@ -32,7 +32,7 @@
#include "block.h"


-static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd);
+static int DentryOpRevalidate(struct dentry *dentry, unsigned int flags);

struct dentry_operations LinkDentryOps = {
.d_revalidate = DentryOpRevalidate,
@@ -60,7 +60,7 @@

static int
DentryOpRevalidate(struct dentry *dentry, // IN: dentry revalidating
- struct nameidata *nd) // IN: lookup flags & intent
+ unsigned int flags) // IN: lookup flags & intent
{
VMBlockInodeInfo *iinfo;
struct nameidata actualNd;
@@ -101,7 +101,7 @@
if (actualDentry &&
actualDentry->d_op &&
actualDentry->d_op->d_revalidate) {
- return actualDentry->d_op->d_revalidate(actualDentry, nd);
+ return actualDentry->d_op->d_revalidate(actualDentry, flags);
}

if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
36 changes: 36 additions & 0 deletions app-emulation/vmware-modules/files/271-3.10-06-inode.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
starting with kernel 3.6, d_revalidate takes an unsigned int "flags"
as the second argument, not a nameidata pointer! see fs/namei.c
for implementation. Also changing vfs_follow_link to nd_set_link.
See: https://lkml.org/lkml/2013/9/9/236

diff -Naur vmblock-only/linux/inode.c vmblock-only/linux/inode.c
--- vmblock-only/linux/inode.c 2013-11-05 23:33:26.000000000 -0500
+++ vmblock-only/linux/inode.c 2014-04-26 10:58:03.063635343 -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,8 @@
goto out;
}

- ret = vfs_follow_link(nd, iinfo->name);
+ nd_set_link(nd, iinfo->name);
+ ret = 0;

out:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
Loading

0 comments on commit 96f8da4

Please sign in to comment.