~sbeattie/apparmor/apparmor-ubuntu-2.6.1-merge

« back to all changes in this revision

Viewing changes to deprecated/kernel-patches/2.6.25/security-unlink.diff

  • Committer: Jamie Strandboge
  • Date: 2011-02-24 18:04:26 UTC
  • mfrom: (1415.3.4 apparmor-ubuntu-trunk)
  • Revision ID: jamie@canonical.com-20110224180426-q39kzcgsktwx8ixj
Released 2.6.0-0ubuntu1 to natty

[ Steve Beattie ]
* New upstream 2.6.0 release (LP: #724193)
  - Patches taken upstream and dropped:
    + 0001-ubuntu-buildd.patch
    + 0003-add-libvirt-support-to-dnsmasq.patch
    + 0004-lp698194.patch
    + 0005-aa-disable.patch
  - debian/rules: remove library path settings for mod_apparmor and
    pam_apprmor builds; upstream handles this properly now.
  - debian/apparmor-utils.install: handle upstream SubDomain.pm =>
    AppArmor.pm renaming
* debian/lib/apparmor/functions: handle profile names with embedded
  spaces (LP: #655523)
* debian/rules, debian/control, debian/python-libapparmor: build
  a python-libapparmor package.
[ Jamie Strandboge ]
* debian/control: use Section: python for python-libapparmor

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
 
@@ -2187,7 +2187,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
 
@@ -345,6 +345,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
 
@@ -1300,7 +1301,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
 
@@ -1567,7 +1569,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
 
@@ -1922,7 +1925,8 @@ static inline int security_inode_link (s
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
 
@@ -300,7 +300,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
 
@@ -370,11 +370,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
 
@@ -2469,11 +2469,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);