~ubuntu-branches/ubuntu/lucid/apparmor/lucid-proposed

« back to all changes in this revision

Viewing changes to kernel-patches/2.6.27/vfs-getxattr.diff

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-11-02 13:33:15 UTC
  • mfrom: (99.1.11 maverick-proposed)
  • Revision ID: james.westby@ubuntu.com-20101102133315-jcil3cqqiz6lr0km
Tags: 2.5.1-0ubuntu0.10.04.1
* Backport 2.5.1-0ubuntu0.10.10.1 from maverick for userspace tools to work
  with newer kernels (LP: #660077)
  NOTE: user-tmp now uses 'owner' match, so non-default profiles will have
  to be adjusted when 2 separately confined applications that both use the
  user-tmp abstraction depend on being able to cooperatively share files
  with each other in /tmp or /var/tmp.
* remove the following patches (features not appropriate for SRU):
  - 0002-add-chromium-browser.patch
  - 0003-local-includes.patch
  - 0004-ubuntu-abstractions-updates.patch
* debian/rules (this makes it the same as what was shipped in 10.04 LTS
  release):
  - don't ship aa-update-browser and its man page (requires
    0004-ubuntu-abstractions-updates.patch)
  - don't ship apparmor.d/local/ (requires 0003-local-includes.patch)
  - don't use dh_apparmor (not in Ubuntu 10.04 LTS)
  - don't ship chromium profile
* remove debian/profiles/chromium-browser
* remove debian/aa-update-browser*
* debian/apparmor-profiles.postinst: revert to that in lucid release
  (requires dh_apparmor and 0002-add-chromium-browser.patch)
* remove debian/apparmor-profiles.postrm: doesn't make sense without
  0002-add-chromium-browser.patch
* debian/control:
  - revert Build-Depends on debhelper (>= 5)
  - revert Standards-Version to 3.8.4
  - revert Vcs-Bzr
  - use Conflicts/Replaces version that was in Ubuntu 10.04 LTS
* debian/patches/0011-lucid-compat-dbus.patch: move /var/lib/dbus/machine-id
  back into dbus, since profiles on 10.04 LTS expect it there
* debian/patches/0012-lucid-compat-kde.patch: add kde4-config to kde
  abstraction, since the firefox profile on Ubuntu 10.04 LTS expects it to
  be there

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From: Tony Jones <tonyj@suse.de>
2
 
Subject: Add a struct vfsmount parameter to vfs_getxattr()
3
 
 
4
 
The vfsmount will be passed down to the LSM hook so that LSMs can compute
5
 
pathnames.
6
 
 
7
 
Signed-off-by: Tony Jones <tonyj@suse.de>
8
 
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
9
 
Signed-off-by: John Johansen <jjohansen@suse.de>
10
 
 
11
 
---
12
 
 fs/nfsd/nfs4xdr.c         |    2 +-
13
 
 fs/nfsd/vfs.c             |   21 ++++++++++++---------
14
 
 fs/xattr.c                |   15 ++++++++-------
15
 
 include/linux/nfsd/nfsd.h |    3 ++-
16
 
 include/linux/xattr.h     |    2 +-
17
 
 5 files changed, 24 insertions(+), 19 deletions(-)
18
 
 
19
 
--- a/fs/nfsd/nfs4xdr.c
20
 
+++ b/fs/nfsd/nfs4xdr.c
21
 
@@ -1446,7 +1446,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s
22
 
        }
23
 
        if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
24
 
                        | FATTR4_WORD0_SUPPORTED_ATTRS)) {
25
 
-               err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
26
 
+               err = nfsd4_get_nfs4_acl(rqstp, dentry, exp->ex_path.mnt, &acl);
27
 
                aclsupport = (err == 0);
28
 
                if (bmval0 & FATTR4_WORD0_ACL) {
29
 
                        if (err == -EOPNOTSUPP)
30
 
--- a/fs/nfsd/vfs.c
31
 
+++ b/fs/nfsd/vfs.c
32
 
@@ -408,11 +408,12 @@ out_nfserr:
33
 
 #if defined(CONFIG_NFSD_V2_ACL) || \
34
 
     defined(CONFIG_NFSD_V3_ACL) || \
35
 
     defined(CONFIG_NFSD_V4)
36
 
-static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
37
 
+static ssize_t nfsd_getxattr(struct dentry *dentry, struct vfsmount *mnt,
38
 
+                            char *key, void **buf)
39
 
 {
40
 
        ssize_t buflen;
41
 
 
42
 
-       buflen = vfs_getxattr(dentry, key, NULL, 0);
43
 
+       buflen = vfs_getxattr(dentry, mnt, key, NULL, 0);
44
 
        if (buflen <= 0)
45
 
                return buflen;
46
 
 
47
 
@@ -420,7 +421,7 @@ static ssize_t nfsd_getxattr(struct dent
48
 
        if (!*buf)
49
 
                return -ENOMEM;
50
 
 
51
 
-       return vfs_getxattr(dentry, key, *buf, buflen);
52
 
+       return vfs_getxattr(dentry, mnt, key, *buf, buflen);
53
 
 }
54
 
 #endif
55
 
 
56
 
@@ -501,13 +502,13 @@ out_nfserr:
57
 
 }
58
 
 
59
 
 static struct posix_acl *
60
 
-_get_posix_acl(struct dentry *dentry, char *key)
61
 
+_get_posix_acl(struct dentry *dentry, struct vfsmount *mnt, char *key)
62
 
 {
63
 
        void *buf = NULL;
64
 
        struct posix_acl *pacl = NULL;
65
 
        int buflen;
66
 
 
67
 
-       buflen = nfsd_getxattr(dentry, key, &buf);
68
 
+       buflen = nfsd_getxattr(dentry, mnt, key, &buf);
69
 
        if (!buflen)
70
 
                buflen = -ENODATA;
71
 
        if (buflen <= 0)
72
 
@@ -519,14 +520,15 @@ _get_posix_acl(struct dentry *dentry, ch
73
 
 }
74
 
 
75
 
 int
76
 
-nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_acl **acl)
77
 
+nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry,
78
 
+                  struct vfsmount *mnt, struct nfs4_acl **acl)
79
 
 {
80
 
        struct inode *inode = dentry->d_inode;
81
 
        int error = 0;
82
 
        struct posix_acl *pacl = NULL, *dpacl = NULL;
83
 
        unsigned int flags = 0;
84
 
 
85
 
-       pacl = _get_posix_acl(dentry, POSIX_ACL_XATTR_ACCESS);
86
 
+       pacl = _get_posix_acl(dentry, mnt, POSIX_ACL_XATTR_ACCESS);
87
 
        if (IS_ERR(pacl) && PTR_ERR(pacl) == -ENODATA)
88
 
                pacl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
89
 
        if (IS_ERR(pacl)) {
90
 
@@ -536,7 +538,7 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqst
91
 
        }
92
 
 
93
 
        if (S_ISDIR(inode->i_mode)) {
94
 
-               dpacl = _get_posix_acl(dentry, POSIX_ACL_XATTR_DEFAULT);
95
 
+               dpacl = _get_posix_acl(dentry, mnt, POSIX_ACL_XATTR_DEFAULT);
96
 
                if (IS_ERR(dpacl) && PTR_ERR(dpacl) == -ENODATA)
97
 
                        dpacl = NULL;
98
 
                else if (IS_ERR(dpacl)) {
99
 
@@ -2052,7 +2054,8 @@ nfsd_get_posix_acl(struct svc_fh *fhp, i
100
 
                return ERR_PTR(-EOPNOTSUPP);
101
 
        }
102
 
 
103
 
-       size = nfsd_getxattr(fhp->fh_dentry, name, &value);
104
 
+       size = nfsd_getxattr(fhp->fh_dentry, fhp->fh_export->ex_path.mnt, name,
105
 
+                            &value);
106
 
        if (size < 0)
107
 
                return ERR_PTR(size);
108
 
 
109
 
--- a/fs/xattr.c
110
 
+++ b/fs/xattr.c
111
 
@@ -131,7 +131,8 @@ out_noalloc:
112
 
 EXPORT_SYMBOL_GPL(xattr_getsecurity);
113
 
 
114
 
 ssize_t
115
 
-vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size)
116
 
+vfs_getxattr(struct dentry *dentry, struct vfsmount *mnt, const char *name,
117
 
+            void *value, size_t size)
118
 
 {
119
 
        struct inode *inode = dentry->d_inode;
120
 
        int error;
121
 
@@ -315,8 +316,8 @@ sys_fsetxattr(int fd, const char __user
122
 
  * Extended attribute GET operations
123
 
  */
124
 
 static ssize_t
125
 
-getxattr(struct dentry *d, const char __user *name, void __user *value,
126
 
-        size_t size)
127
 
+getxattr(struct dentry *dentry, struct vfsmount *mnt, const char __user *name,
128
 
+        void __user *value, size_t size)
129
 
 {
130
 
        ssize_t error;
131
 
        void *kvalue = NULL;
132
 
@@ -336,7 +337,7 @@ getxattr(struct dentry *d, const char __
133
 
                        return -ENOMEM;
134
 
        }
135
 
 
136
 
-       error = vfs_getxattr(d, kname, kvalue, size);
137
 
+       error = vfs_getxattr(dentry, mnt, kname, kvalue, size);
138
 
        if (error > 0) {
139
 
                if (size && copy_to_user(value, kvalue, error))
140
 
                        error = -EFAULT;
141
 
@@ -359,7 +360,7 @@ sys_getxattr(const char __user *pathname
142
 
        error = user_path(pathname, &path);
143
 
        if (error)
144
 
                return error;
145
 
-       error = getxattr(path.dentry, name, value, size);
146
 
+       error = getxattr(path.dentry, path.mnt, name, value, size);
147
 
        path_put(&path);
148
 
        return error;
149
 
 }
150
 
@@ -374,7 +375,7 @@ sys_lgetxattr(const char __user *pathnam
151
 
        error = user_lpath(pathname, &path);
152
 
        if (error)
153
 
                return error;
154
 
-       error = getxattr(path.dentry, name, value, size);
155
 
+       error = getxattr(path.dentry, path.mnt, name, value, size);
156
 
        path_put(&path);
157
 
        return error;
158
 
 }
159
 
@@ -389,7 +390,7 @@ sys_fgetxattr(int fd, const char __user
160
 
        if (!f)
161
 
                return error;
162
 
        audit_inode(NULL, f->f_path.dentry);
163
 
-       error = getxattr(f->f_path.dentry, name, value, size);
164
 
+       error = getxattr(f->f_path.dentry, f->f_path.mnt, name, value, size);
165
 
        fput(f);
166
 
        return error;
167
 
 }
168
 
--- a/include/linux/nfsd/nfsd.h
169
 
+++ b/include/linux/nfsd/nfsd.h
170
 
@@ -85,7 +85,8 @@ __be32                nfsd_setattr(struct svc_rqst *,
171
 
 #ifdef CONFIG_NFSD_V4
172
 
 __be32          nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *,
173
 
                     struct nfs4_acl *);
174
 
-int             nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **);
175
 
+int             nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *,
176
 
+                               struct vfsmount *mnt, struct nfs4_acl **);
177
 
 #endif /* CONFIG_NFSD_V4 */
178
 
 __be32         nfsd_create(struct svc_rqst *, struct svc_fh *,
179
 
                                char *name, int len, struct iattr *attrs,
180
 
--- a/include/linux/xattr.h
181
 
+++ b/include/linux/xattr.h
182
 
@@ -48,7 +48,7 @@ struct xattr_handler {
183
 
 };
184
 
 
185
 
 ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
186
 
-ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
187
 
+ssize_t vfs_getxattr(struct dentry *, struct vfsmount *, const char *, void *, size_t);
188
 
 ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
189
 
 int vfs_setxattr(struct dentry *, struct vfsmount *, const char *, const void *, size_t, int);
190
 
 int vfs_removexattr(struct dentry *, const char *);