VMware 10 patch for linux kernel 3.17

1.Create the patch “vmware.pacth”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff -rupN source.orig/vmci-only/linux/driver.c source/vmci-only/linux/driver.c
--- source.orig/vmci-only/linux/driver.c	2014-06-13 02:20:45.000000000 +0300
+++ source/vmci-only/linux/driver.c	2014-10-10 04:21:26.955903580 +0300
@@ -737,7 +737,7 @@ LinuxDriver_Ioctl(struct inode *inode,
          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);
diff -rupN source.orig/vmci-only/shared/vm_assert.h source/vmci-only/shared/vm_assert.h
--- source.orig/vmci-only/shared/vm_assert.h	2014-06-13 02:20:46.000000000 +0300
+++ source/vmci-only/shared/vm_assert.h	2014-10-10 04:21:26.955903580 +0300
@@ -256,6 +256,7 @@ void WarningThrottled(uint32 *count, con
                                        __FILE__, __LINE__, __FUNCTION__, \
                                        _fix))
 #else
+   #undef DEPRECATED /* in <linux/printk.h> since 3.14.0 */
    #define DEPRECATED(_fix) do {} while (0)
 #endif
 
diff -rupN source.orig/vmmon-only/include/vm_assert.h source/vmmon-only/include/vm_assert.h
--- source.orig/vmmon-only/include/vm_assert.h	2014-06-13 03:38:24.000000000 +0300
+++ source/vmmon-only/include/vm_assert.h	2014-10-10 04:21:26.955903580 +0300
@@ -256,6 +256,7 @@ void WarningThrottled(uint32 *count, con
                                        __FILE__, __LINE__, __FUNCTION__, \
                                        _fix))
 #else
+   #undef DEPRECATED /* in <linux/printk.h> since 3.14.0 */
    #define DEPRECATED(_fix) do {} while (0)
 #endif
 
diff -rupN source.orig/vmmon-only/linux/driver.c source/vmmon-only/linux/driver.c
--- source.orig/vmmon-only/linux/driver.c	2014-06-13 03:38:24.000000000 +0300
+++ source/vmmon-only/linux/driver.c	2014-10-10 04:21:26.959236913 +0300
@@ -1338,7 +1338,9 @@ LinuxDriverReadTSC(void *data,   // OUT:
  *-----------------------------------------------------------------------------
  */
 
-__attribute__((always_inline)) static Bool
+#include <linux/compiler-gcc.h>
+
+__always_inline static Bool
 LinuxDriverSyncReadTSCs(uint64 *delta) // OUT: TSC max - TSC min
 {
    TSCDelta tscDelta;
diff -rupN source.orig/vmnet-only/netif.c source/vmnet-only/netif.c
--- source.orig/vmnet-only/netif.c	2014-06-13 03:38:25.000000000 +0300
+++ source/vmnet-only/netif.c	2014-10-10 04:46:42.179229797 +0300
@@ -149,7 +149,7 @@ VNetNetIf_Create(char *devName,  // IN:
    memcpy(deviceName, devName, sizeof deviceName);
    NULL_TERMINATE_STRING(deviceName);
 
-   dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
+   dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup);
    if (!dev) {
       retval = -ENOMEM;
       goto out;
diff -rupN source.orig/vmnet-only/vm_assert.h source/vmnet-only/vm_assert.h
--- source.orig/vmnet-only/vm_assert.h	2014-06-13 03:38:25.000000000 +0300
+++ source/vmnet-only/vm_assert.h	2014-10-10 04:21:26.959236913 +0300
@@ -256,6 +256,7 @@ void WarningThrottled(uint32 *count, con
                                        __FILE__, __LINE__, __FUNCTION__, \
                                        _fix))
 #else
+   #undef DEPRECATED /* in <linux/printk.h> since 3.14.0 */
    #define DEPRECATED(_fix) do {} while (0)
 #endif
 
diff -rupN source.orig/vsock-only/linux/af_vsock.c source/vsock-only/linux/af_vsock.c
--- source.orig/vsock-only/linux/af_vsock.c	2014-06-13 02:20:46.000000000 +0300
+++ source/vsock-only/linux/af_vsock.c	2014-10-10 04:21:26.959236913 +0300
@@ -2869,7 +2869,7 @@ __VSockVmciCreate(struct net *net,
       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 -rupN source.orig/vsock-only/linux/notify.c source/vsock-only/linux/notify.c
--- source.orig/vsock-only/linux/notify.c	2014-06-13 02:20:46.000000000 +0300
+++ source/vsock-only/linux/notify.c	2014-10-10 04:21:26.962570246 +0300
@@ -516,7 +516,7 @@ VSockVmciHandleWrote(struct sock *sk,
    PKT_FIELD(vsk, sentWaitingRead) = FALSE;
 #endif
 
-   sk->sk_data_ready(sk, 0);
+   sk->sk_data_ready(sk);
 }
 
 
diff -rupN source.orig/vsock-only/linux/notifyQState.c source/vsock-only/linux/notifyQState.c
--- source.orig/vsock-only/linux/notifyQState.c	2014-06-13 02:20:46.000000000 +0300
+++ source/vsock-only/linux/notifyQState.c	2014-10-10 04:21:26.962570246 +0300
@@ -164,7 +164,7 @@ VSockVmciHandleWrote(struct sock *sk,
                      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 @@ VSockVmciNotifyPktRecvPostDequeue(struct
       }
 
       /* See the comment in VSockVmciNotifyPktSendPostEnqueue */
-      sk->sk_data_ready(sk, 0);
+      sk->sk_data_ready(sk);
    }
 
    return err;
diff -rupN source.orig/vsock-only/shared/vm_assert.h source/vsock-only/shared/vm_assert.h
--- source.orig/vsock-only/shared/vm_assert.h	2014-06-13 02:20:46.000000000 +0300
+++ source/vsock-only/shared/vm_assert.h	2014-10-10 04:21:26.962570246 +0300
@@ -256,6 +256,7 @@ void WarningThrottled(uint32 *count, con
                                        __FILE__, __LINE__, __FUNCTION__, \
                                        _fix))
 #else
+   #undef DEPRECATED /* in <linux/printk.h> since 3.14.0 */
    #define DEPRECATED(_fix) do {} while (0)
 #endif

2.Create the patch “vmware-service.pacth”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- ./vmware	2014-04-25 03:42:20.029114143 +0800
+++ ./vmware	2014-04-25 03:43:34.042445658 +0800
@@ -181,7 +181,7 @@
 
    # only load vmci if it's not already loaded
    if [ "`isLoaded "$mod"`" = 'no' ]; then
-      vmwareLoadModule "$mod"
+      vmwareLoadModule "$vmci"
    fi
    vmware_rm_stale_node "$vmciNode"
    if [ ! -e "/dev/$vmciNode" ]; then
@@ -231,7 +231,7 @@
 
    # only unload vmci if it's already loaded
    if [ "`isLoaded "${mod}"`" = 'yes' ]; then
-      vmwareUnloadModule "${mod}"
+      vmwareUnloadModule "$vmci"
    fi
    rm -f "/dev/$vmciNode"
 }
@@ -249,7 +249,7 @@
    mod=$(vmwareRealModName $vsock $vsock_alias)
    # only load vsock if it's not already loaded
    if [ "`isLoaded "$mod"`" = 'no' ]; then
-      vmwareLoadModule "$mod"
+      vmwareLoadModule "$vsock"
    fi
    vmware_rm_stale_node "$vsockNode"
    # Give udev 5 seconds to create our node
@@ -269,7 +269,7 @@
    mod=$(vmwareRealModName $vsock $vsock_alias)
    # only unload vsock if it's already loaded
    if [ "`isLoaded "$mod"`" = 'yes' ]; then
-     vmwareUnloadModule "$mod"
+     vmwareUnloadModule "$vsock"
    fi
    rm -f /dev/vsock
 }

3.Begin patching

1
2
3
4
5
6
7
8
9
10
11
12
root# cd /usr/lib/vmware/modules/source
root# cp /home/username/Downloads/vmware.patch .
root# for i in vmci vmmon vmnet vsock; do tar -xf $i.tar; done
root# patch -p0 -i ./vmware.patch
root# for i in *-only; do tar -cf ${i/-only}.tar $i; done
root# rm -r *-only
root# rm -rf vmware.patch
root# vmware-modconfig --console --install-all
root# cd /etc/init.d/
root# cp /home/username/Downloads/vmware-service.pacth .
root# patch vmware &lt; ./vmware-service.pacth
root# rm -rf vmware-service.pacth

4.Create the server file “vmware.service”

1
2
3
4
5
6
7
8
9
10
11
12
13
[Unit]
Description=VMware daemon
Requires=vmware-usbarbitrator.service
Before=vmware-usbarbitrator.service
 
[Service]
ExecStart=/etc/init.d/vmware start
ExecStop=/etc/init.d/vmware stop
PIDFile=/var/lock/subsys/vmware
RemainAfterExit=yes
 
[Install]
WantedBy=multi-user.target

5.Create the server file “vmware-usbarbitrator.service”

1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=VMware USB Arbitrator
Requires=vmware.service
After=vmware.service
 
[Service]
ExecStart=/usr/bin/vmware-usbarbitrator
ExecStop=/usr/bin/vmware-usbarbitrator --kill
RemainAfterExit=yes
 
[Install]
WantedBy=multi-user.target

6.Create the server file “vmware-workstation.service”

1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=VMware Workstation Server daemon
Requires=vmware.service
After=vmware.service
 
[Service]
ExecStart=/etc/init.d/vmware-workstation-server start
ExecStop=/etc/init.d/vmware-workstation-server stop
RemainAfterExit=yes
 
[Install]
WantedBy=multi-user.target

7.move the server file to /etc/systemd/system/,and enable the server

1
2
3
4
root# mv vmware-workstation.service vmware-usbarbitrator.service vmware.service /etc/systemd/system/
root# systemctl enable vmware
root# systemctl enable vmware-usbarbitrator
root# systemctl enable vmware-workstation

8.over

发表评论

电子邮件地址不会被公开。 必填项已用*标注