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

« back to all changes in this revision

Viewing changes to kernel-patches/2.6.28/vfs-setxattr.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_setxattr()
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/vfs.c         |   16 +++++++++++-----
13
 
 fs/xattr.c            |   16 ++++++++--------
14
 
 include/linux/xattr.h |    3 ++-
15
 
 3 files changed, 21 insertions(+), 14 deletions(-)
16
 
 
17
 
--- a/fs/nfsd/vfs.c
18
 
+++ b/fs/nfsd/vfs.c
19
 
@@ -429,7 +429,8 @@ static ssize_t nfsd_getxattr(struct dent
20
 
 
21
 
 #if defined(CONFIG_NFSD_V4)
22
 
 static int
23
 
-set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key)
24
 
+set_nfsv4_acl_one(struct dentry *dentry, struct vfsmount *mnt,
25
 
+                 struct posix_acl *pacl, char *key)
26
 
 {
27
 
        int len;
28
 
        size_t buflen;
29
 
@@ -448,7 +449,7 @@ set_nfsv4_acl_one(struct dentry *dentry,
30
 
                goto out;
31
 
        }
32
 
 
33
 
-       error = vfs_setxattr(dentry, key, buf, len, 0);
34
 
+       error = vfs_setxattr(dentry, mnt, key, buf, len, 0);
35
 
 out:
36
 
        kfree(buf);
37
 
        return error;
38
 
@@ -461,6 +462,7 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqst
39
 
        __be32 error;
40
 
        int host_error;
41
 
        struct dentry *dentry;
42
 
+       struct vfsmount *mnt;
43
 
        struct inode *inode;
44
 
        struct posix_acl *pacl = NULL, *dpacl = NULL;
45
 
        unsigned int flags = 0;
46
 
@@ -471,6 +473,7 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqst
47
 
                return error;
48
 
 
49
 
        dentry = fhp->fh_dentry;
50
 
+       mnt = fhp->fh_export->ex_path.mnt;
51
 
        inode = dentry->d_inode;
52
 
        if (S_ISDIR(inode->i_mode))
53
 
                flags = NFS4_ACL_DIR;
54
 
@@ -481,12 +484,14 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqst
55
 
        } else if (host_error < 0)
56
 
                goto out_nfserr;
57
 
 
58
 
-       host_error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS);
59
 
+       host_error = set_nfsv4_acl_one(dentry, mnt, pacl,
60
 
+                                      POSIX_ACL_XATTR_ACCESS);
61
 
        if (host_error < 0)
62
 
                goto out_release;
63
 
 
64
 
        if (S_ISDIR(inode->i_mode))
65
 
-               host_error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT);
66
 
+               host_error = set_nfsv4_acl_one(dentry, mnt, dpacl,
67
 
+                                              POSIX_ACL_XATTR_DEFAULT);
68
 
 
69
 
 out_release:
70
 
        posix_acl_release(pacl);
71
 
@@ -2202,7 +2207,8 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i
72
 
        if (error)
73
 
                goto getout;
74
 
        if (size)
75
 
-               error = vfs_setxattr(fhp->fh_dentry, name, value, size, 0);
76
 
+               error = vfs_setxattr(fhp->fh_dentry, fhp->fh_export->ex_path.mnt,
77
 
+                                    name, value, size,0);
78
 
        else {
79
 
                if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT)
80
 
                        error = 0;
81
 
--- a/fs/xattr.c
82
 
+++ b/fs/xattr.c
83
 
@@ -67,8 +67,8 @@ xattr_permission(struct inode *inode, co
84
 
 }
85
 
 
86
 
 int
87
 
-vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
88
 
-               size_t size, int flags)
89
 
+vfs_setxattr(struct dentry *dentry, struct vfsmount *mnt, const char *name,
90
 
+            const void *value, size_t size, int flags)
91
 
 {
92
 
        struct inode *inode = dentry->d_inode;
93
 
        int error;
94
 
@@ -218,8 +218,8 @@ EXPORT_SYMBOL_GPL(vfs_removexattr);
95
 
  * Extended attribute SET operations
96
 
  */
97
 
 static long
98
 
-setxattr(struct dentry *d, const char __user *name, const void __user *value,
99
 
-        size_t size, int flags)
100
 
+setxattr(struct dentry *dentry, struct vfsmount *mnt, const char __user *name,
101
 
+        const void __user *value, size_t size, int flags)
102
 
 {
103
 
        int error;
104
 
        void *kvalue = NULL;
105
 
@@ -246,7 +246,7 @@ setxattr(struct dentry *d, const char __
106
 
                }
107
 
        }
108
 
 
109
 
-       error = vfs_setxattr(d, kname, kvalue, size, flags);
110
 
+       error = vfs_setxattr(dentry, mnt, kname, kvalue, size, flags);
111
 
        kfree(kvalue);
112
 
        return error;
113
 
 }
114
 
@@ -263,7 +263,7 @@ sys_setxattr(const char __user *pathname
115
 
                return error;
116
 
        error = mnt_want_write(path.mnt);
117
 
        if (!error) {
118
 
-               error = setxattr(path.dentry, name, value, size, flags);
119
 
+               error = setxattr(path.dentry, path.mnt, name, value, size, flags);
120
 
                mnt_drop_write(path.mnt);
121
 
        }
122
 
        path_put(&path);
123
 
@@ -282,7 +282,7 @@ sys_lsetxattr(const char __user *pathnam
124
 
                return error;
125
 
        error = mnt_want_write(path.mnt);
126
 
        if (!error) {
127
 
-               error = setxattr(path.dentry, name, value, size, flags);
128
 
+               error = setxattr(path.dentry, path.mnt, name, value, size, flags);
129
 
                mnt_drop_write(path.mnt);
130
 
        }
131
 
        path_put(&path);
132
 
@@ -304,7 +304,7 @@ sys_fsetxattr(int fd, const char __user
133
 
        audit_inode(NULL, dentry);
134
 
        error = mnt_want_write(f->f_path.mnt);
135
 
        if (!error) {
136
 
-               error = setxattr(dentry, name, value, size, flags);
137
 
+               error = setxattr(dentry, f->f_vfsmnt, name, value, size, flags);
138
 
                mnt_drop_write(f->f_path.mnt);
139
 
        }
140
 
        fput(f);
141
 
--- a/include/linux/xattr.h
142
 
+++ b/include/linux/xattr.h
143
 
@@ -16,6 +16,7 @@
144
 
 #ifdef  __KERNEL__
145
 
 
146
 
 #include <linux/types.h>
147
 
+#include <linux/mount.h>
148
 
 
149
 
 /* Namespaces */
150
 
 #define XATTR_OS2_PREFIX "os2."
151
 
@@ -49,7 +50,7 @@ struct xattr_handler {
152
 
 ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
153
 
 ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
154
 
 ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
155
 
-int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
156
 
+int vfs_setxattr(struct dentry *, struct vfsmount *, const char *, const void *, size_t, int);
157
 
 int vfs_removexattr(struct dentry *, const char *);
158
 
 
159
 
 ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);