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

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/security-unlink.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_unlink 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/namei.c               |    2 +-
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, 16 insertions(+), 9 deletions(-)
17
 
 
18
 
--- a/fs/namei.c
19
 
+++ b/fs/namei.c
20
 
@@ -2324,7 +2324,7 @@ int vfs_unlink(struct inode *dir, struct
21
 
        if (d_mountpoint(dentry))
22
 
                error = -EBUSY;
23
 
        else {
24
 
-               error = security_inode_unlink(dir, dentry);
25
 
+               error = security_inode_unlink(dir, dentry, mnt);
26
 
                if (!error)
27
 
                        error = dir->i_op->unlink(dir, dentry);
28
 
        }
29
 
--- a/include/linux/security.h
30
 
+++ b/include/linux/security.h
31
 
@@ -356,6 +356,7 @@ static inline void security_free_mnt_opt
32
 
  *     Check the permission to remove a hard link to a file.
33
 
  *     @dir contains the inode structure of parent directory of the file.
34
 
  *     @dentry contains the dentry structure for file to be unlinked.
35
 
+ *     @mnt is the vfsmount corresponding to @dentry (may be NULL).
36
 
  *     Return 0 if permission is granted.
37
 
  * @inode_symlink:
38
 
  *     Check the permission to create a symbolic link to a file.
39
 
@@ -1369,7 +1370,8 @@ struct security_operations {
40
 
        int (*inode_link) (struct dentry *old_dentry, struct vfsmount *old_mnt,
41
 
                           struct inode *dir, struct dentry *new_dentry,
42
 
                           struct vfsmount *new_mnt);
43
 
-       int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
44
 
+       int (*inode_unlink) (struct inode *dir, struct dentry *dentry,
45
 
+                            struct vfsmount *mnt);
46
 
        int (*inode_symlink) (struct inode *dir, struct dentry *dentry,
47
 
                              struct vfsmount *mnt, const char *old_name);
48
 
        int (*inode_mkdir) (struct inode *dir, struct dentry *dentry,
49
 
@@ -1646,7 +1648,8 @@ int security_inode_create(struct inode *
50
 
 int security_inode_link(struct dentry *old_dentry, struct vfsmount *old_mnt,
51
 
                        struct inode *dir, struct dentry *new_dentry,
52
 
                        struct vfsmount *new_mnt);
53
 
-int security_inode_unlink(struct inode *dir, struct dentry *dentry);
54
 
+int security_inode_unlink(struct inode *dir, struct dentry *dentry,
55
 
+                         struct vfsmount *mnt);
56
 
 int security_inode_symlink(struct inode *dir, struct dentry *dentry,
57
 
                           struct vfsmount *mnt, const char *old_name);
58
 
 int security_inode_mkdir(struct inode *dir, struct dentry *dentry,
59
 
@@ -2003,7 +2006,8 @@ static inline int security_inode_link(st
60
 
 }
61
 
 
62
 
 static inline int security_inode_unlink(struct inode *dir,
63
 
-                                        struct dentry *dentry)
64
 
+                                       struct dentry *dentry,
65
 
+                                       struct vfsmount *mnt)
66
 
 {
67
 
        return 0;
68
 
 }
69
 
--- a/security/dummy.c
70
 
+++ b/security/dummy.c
71
 
@@ -302,7 +302,8 @@ static int dummy_inode_link (struct dent
72
 
        return 0;
73
 
 }
74
 
 
75
 
-static int dummy_inode_unlink (struct inode *inode, struct dentry *dentry)
76
 
+static int dummy_inode_unlink (struct inode *inode, struct dentry *dentry,
77
 
+                              struct vfsmount *mnt)
78
 
 {
79
 
        return 0;
80
 
 }
81
 
--- a/security/security.c
82
 
+++ b/security/security.c
83
 
@@ -406,11 +406,12 @@ int security_inode_link(struct dentry *o
84
 
                                         new_dentry, new_mnt);
85
 
 }
86
 
 
87
 
-int security_inode_unlink(struct inode *dir, struct dentry *dentry)
88
 
+int security_inode_unlink(struct inode *dir, struct dentry *dentry,
89
 
+                         struct vfsmount *mnt)
90
 
 {
91
 
        if (unlikely(IS_PRIVATE(dentry->d_inode)))
92
 
                return 0;
93
 
-       return security_ops->inode_unlink(dir, dentry);
94
 
+       return security_ops->inode_unlink(dir, dentry, mnt);
95
 
 }
96
 
 
97
 
 int security_inode_symlink(struct inode *dir, struct dentry *dentry,
98
 
--- a/security/selinux/hooks.c
99
 
+++ b/security/selinux/hooks.c
100
 
@@ -2528,11 +2528,12 @@ static int selinux_inode_link(struct den
101
 
        return may_link(dir, old_dentry, MAY_LINK);
102
 
 }
103
 
 
104
 
-static int selinux_inode_unlink(struct inode *dir, struct dentry *dentry)
105
 
+static int selinux_inode_unlink(struct inode *dir, struct dentry *dentry,
106
 
+                               struct vfsmount *mnt)
107
 
 {
108
 
        int rc;
109
 
 
110
 
-       rc = secondary_ops->inode_unlink(dir, dentry);
111
 
+       rc = secondary_ops->inode_unlink(dir, dentry, mnt);
112
 
        if (rc)
113
 
                return rc;
114
 
        return may_link(dir, dentry, MAY_UNLINK);