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

« back to all changes in this revision

Viewing changes to kernel-patches/2.6.26/security-setattr.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: Pass struct vfsmount to the inode_setattr LSM hook
3
 
 
4
 
This is needed for computing pathnames in the AppArmor LSM.
5
 
 
6
 
Signed-off-by: Tony Jones <tonyj@suse.de>
7
 
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
8
 
Signed-off-by: John Johansen <jjohansen@suse.de>
9
 
 
10
 
---
11
 
 fs/attr.c                |    4 ++--
12
 
 include/linux/security.h |   10 +++++++---
13
 
 security/dummy.c         |    3 ++-
14
 
 security/security.c      |    5 +++--
15
 
 security/selinux/hooks.c |    5 +++--
16
 
 5 files changed, 17 insertions(+), 10 deletions(-)
17
 
 
18
 
--- a/fs/attr.c
19
 
+++ b/fs/attr.c
20
 
@@ -159,13 +159,13 @@ int notify_change(struct dentry *dentry,
21
 
                down_write(&dentry->d_inode->i_alloc_sem);
22
 
 
23
 
        if (inode->i_op && inode->i_op->setattr) {
24
 
-               error = security_inode_setattr(dentry, attr);
25
 
+               error = security_inode_setattr(dentry, mnt, attr);
26
 
                if (!error)
27
 
                        error = inode->i_op->setattr(dentry, attr);
28
 
        } else {
29
 
                error = inode_change_ok(inode, attr);
30
 
                if (!error)
31
 
-                       error = security_inode_setattr(dentry, attr);
32
 
+                       error = security_inode_setattr(dentry, mnt, attr);
33
 
                if (!error) {
34
 
                        if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
35
 
                            (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
36
 
--- a/include/linux/security.h
37
 
+++ b/include/linux/security.h
38
 
@@ -416,6 +416,7 @@ static inline void security_free_mnt_opt
39
 
  *     file attributes change (such as when a file is truncated, chown/chmod
40
 
  *     operations, transferring disk quotas, etc).
41
 
  *     @dentry contains the dentry structure for the file.
42
 
+ *     @mnt is the vfsmount corresponding to @dentry (may be NULL).
43
 
  *     @attr is the iattr structure containing the new file attributes.
44
 
  *     Return 0 if permission is granted.
45
 
  * @inode_getattr:
46
 
@@ -1372,7 +1373,8 @@ struct security_operations {
47
 
        int (*inode_readlink) (struct dentry *dentry);
48
 
        int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
49
 
        int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd);
50
 
-       int (*inode_setattr)    (struct dentry *dentry, struct iattr *attr);
51
 
+       int (*inode_setattr) (struct dentry *dentry, struct vfsmount *mnt,
52
 
+                             struct iattr *attr);
53
 
        int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
54
 
        void (*inode_delete) (struct inode *inode);
55
 
        int (*inode_setxattr) (struct dentry *dentry, const char *name,
56
 
@@ -1644,7 +1646,8 @@ int security_inode_rename(struct inode *
57
 
 int security_inode_readlink(struct dentry *dentry);
58
 
 int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
59
 
 int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
60
 
-int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
61
 
+int security_inode_setattr(struct dentry *dentry, struct vfsmount *mnt,
62
 
+                          struct iattr *attr);
63
 
 int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
64
 
 void security_inode_delete(struct inode *inode);
65
 
 int security_inode_setxattr(struct dentry *dentry, const char *name,
66
 
@@ -2042,7 +2045,8 @@ static inline int security_inode_permiss
67
 
 }
68
 
 
69
 
 static inline int security_inode_setattr(struct dentry *dentry,
70
 
-                                         struct iattr *attr)
71
 
+                                        struct vfsmount *mnt,
72
 
+                                        struct iattr *attr)
73
 
 {
74
 
        return 0;
75
 
 }
76
 
--- a/security/dummy.c
77
 
+++ b/security/dummy.c
78
 
@@ -352,7 +352,8 @@ static int dummy_inode_permission (struc
79
 
        return 0;
80
 
 }
81
 
 
82
 
-static int dummy_inode_setattr (struct dentry *dentry, struct iattr *iattr)
83
 
+static int dummy_inode_setattr (struct dentry *dentry, struct vfsmount *mnt,
84
 
+                               struct iattr *iattr)
85
 
 {
86
 
        return 0;
87
 
 }
88
 
--- a/security/security.c
89
 
+++ b/security/security.c
90
 
@@ -471,11 +471,12 @@ int security_inode_permission(struct ino
91
 
        return security_ops->inode_permission(inode, mask, nd);
92
 
 }
93
 
 
94
 
-int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
95
 
+int security_inode_setattr(struct dentry *dentry, struct vfsmount *mnt,
96
 
+                          struct iattr *attr)
97
 
 {
98
 
        if (unlikely(IS_PRIVATE(dentry->d_inode)))
99
 
                return 0;
100
 
-       return security_ops->inode_setattr(dentry, attr);
101
 
+       return security_ops->inode_setattr(dentry, mnt, attr);
102
 
 }
103
 
 
104
 
 int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
105
 
--- a/security/selinux/hooks.c
106
 
+++ b/security/selinux/hooks.c
107
 
@@ -2598,11 +2598,12 @@ static int selinux_inode_permission(stru
108
 
                               open_file_mask_to_av(inode->i_mode, mask), NULL);
109
 
 }
110
 
 
111
 
-static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr)
112
 
+static int selinux_inode_setattr(struct dentry *dentry, struct vfsmount *mnt,
113
 
+                                struct iattr *iattr)
114
 
 {
115
 
        int rc;
116
 
 
117
 
-       rc = secondary_ops->inode_setattr(dentry, iattr);
118
 
+       rc = secondary_ops->inode_setattr(dentry, mnt, iattr);
119
 
        if (rc)
120
 
                return rc;
121