summaryrefslogtreecommitdiff
blob: 7c14481ad12ea9f70a71044a796c8bd7d20a4713 (plain)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
diff -rpNu vmblock-only.orig/linux/control.c vmblock-only/linux/control.c
--- vmblock-only.orig/linux/control.c	2014-01-16 00:09:12.000949255 -0800
+++ vmblock-only/linux/control.c	2014-01-16 00:10:46.916483268 -0800
@@ -279,7 +279,7 @@ ExecuteBlockOp(const char __user *buf,
    int i;
    int retval;
 
-   name = getname(buf);
+   name = (char*) getname(buf)->name;
    if (IS_ERR(name)) {
       return PTR_ERR(name);
    }
diff -rpNu vmblock-only.orig/linux/dentry.c vmblock-only/linux/dentry.c
--- vmblock-only.orig/linux/dentry.c	2013-10-18 10:56:11.000000000 -0700
+++ vmblock-only/linux/dentry.c	2014-01-16 00:10:46.916483268 -0800
@@ -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 @@ struct dentry_operations LinkDentryOps =
 
 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 @@ DentryOpRevalidate(struct dentry *dentry
    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)) {
diff -rpNu vmblock-only.orig/linux/inode.c vmblock-only/linux/inode.c
--- vmblock-only.orig/linux/inode.c	2014-01-16 00:10:15.046625108 -0800
+++ vmblock-only/linux/inode.c	2014-01-16 00:10:46.916483268 -0800
@@ -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 inode_operations LinkInode
 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;
@@ -135,7 +135,8 @@ InodeOpLookup(struct inode *dir,      //
    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;
+   i_uid_write(inode, 0);
+   i_gid_write(inode, 0);
    inode->i_op = &LinkInodeOps;
 
    d_add(dentry, inode);
@@ -221,7 +222,7 @@ InodeOpFollowlink(struct dentry *dentry,
       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 -rpNu vmci-only.orig/linux/driver.c vmci-only/linux/driver.c
--- vmci-only.orig/linux/driver.c    2013-10-18 10:56:11.000000000 -0700
+++ vmci-only/linux/driver.c   2014-01-08 10:41:27.000000000 -0800
@@ -51,6 +51,7 @@ sys_ioctl(unsigned int fd, unsigned int
 #include "compat_slab.h"
 #include "compat_uaccess.h"
 #include "compat_version.h"
+#include "compat_cred.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 9)
 #  error "Linux kernels before 2.6.9 are not supported."
@@ -737,7 +738,7 @@ LinuxDriver_Ioctl(struct inode *inode,
          goto init_release;
       }
 
-      user = current_uid();
+      user = CURRENT_UID();
       retval = VMCIContext_InitContext(initBlock.cid, initBlock.flags,
                                        0 /* Unused */, vmciLinux->userVersion,
                                        &user, &vmciLinux->context);
diff -rpNu vmci-only.orig/shared/compat_cred.h vmci-only/shared/compat_cred.h
--- vmci-only.orig/shared/compat_cred.h      2013-10-18 10:56:11.000000000 -0700
+++ vmci-only/shared/compat_cred.h     2014-01-08 10:39:22.000000000 -0800
@@ -35,6 +35,14 @@
 #define current_fsgid() (current->fsgid)
 #endif
 
+#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
+#define CURRENT_UID() (__kuid_val(current_uid()))
+#define CURRENT_GID() (__kgid_val(current_gid()))
+#else
+#define CURRENT_UID() (current_uid())
+#define CURRENT_GID() (current_gid())
+#endif
+
 #if !defined(cap_set_full)
 /* cap_set_full was removed in kernel version 3.0-rc4. */
 #define cap_set_full(_c) do { (_c) = CAP_FULL_SET; } while (0)
diff -rpNu vsock-only.orig/shared/compat_cred.h vsock-only/shared/compat_cred.h
--- vsock-only.orig/shared/compat_cred.h      2013-10-18 10:56:11.000000000 -0700
+++ vsock-only/shared/compat_cred.h     2014-01-08 10:39:22.000000000 -0800
@@ -35,6 +35,14 @@
 #define current_fsgid() (current->fsgid)
 #endif
 
+#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
+#define CURRENT_UID() (__kuid_val(current_uid()))
+#define CURRENT_GID() (__kgid_val(current_gid()))
+#else
+#define CURRENT_UID() (current_uid())
+#define CURRENT_GID() (current_gid())
+#endif
+
 #if !defined(cap_set_full)
 /* cap_set_full was removed in kernel version 3.0-rc4. */
 #define cap_set_full(_c) do { (_c) = CAP_FULL_SET; } while (0)


diff -urpN vsock-only.orig/linux/af_vsock.c vsock-only/linux/af_vsock.c
--- vsock-only.orig/linux/af_vsock.c	2013-10-18 10:56:12.000000000 -0700
+++ vsock-only/linux/af_vsock.c	2014-01-16 12:21:34.594978553 -0800
@@ -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 = CURRENT_UID();
       vsk->queuePairSize = VSOCK_DEFAULT_QP_SIZE;
       vsk->queuePairMinSize = VSOCK_DEFAULT_QP_SIZE_MIN;
       vsk->queuePairMaxSize = VSOCK_DEFAULT_QP_SIZE_MAX;