]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.39/patches.apparmor/security-link.diff
Add ignored *.diff files of the xen patches
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.apparmor / security-link.diff
diff --git a/src/patches/suse-2.6.27.39/patches.apparmor/security-link.diff b/src/patches/suse-2.6.27.39/patches.apparmor/security-link.diff
new file mode 100644 (file)
index 0000000..b43e1e6
--- /dev/null
@@ -0,0 +1,149 @@
+From: Tony Jones <tonyj@suse.de>
+Subject: Pass the struct vfsmounts to the inode_link LSM hook
+
+This is needed for computing pathnames in the AppArmor LSM.
+
+Signed-off-by: Tony Jones <tonyj@suse.de>
+Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
+Signed-off-by: John Johansen <jjohansen@suse.de>
+
+---
+ fs/namei.c                 |    3 ++-
+ include/linux/security.h   |   18 ++++++++++++------
+ security/capability.c      |    5 +++--
+ security/security.c        |    8 +++++---
+ security/selinux/hooks.c   |    9 +++++++--
+ security/smack/smack_lsm.c |    5 +++--
+ 6 files changed, 32 insertions(+), 16 deletions(-)
+
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -2437,7 +2437,8 @@ int vfs_link(struct dentry *old_dentry,
+       if (S_ISDIR(inode->i_mode))
+               return -EPERM;
+-      error = security_inode_link(old_dentry, dir, new_dentry);
++      error = security_inode_link(old_dentry, old_mnt, dir, new_dentry,
++                                  new_mnt);
+       if (error)
+               return error;
+--- a/include/linux/security.h
++++ b/include/linux/security.h
+@@ -343,8 +343,10 @@ static inline void security_free_mnt_opt
+  * @inode_link:
+  *    Check permission before creating a new hard link to a file.
+  *    @old_dentry contains the dentry structure for an existing link to the file.
++ *    @old_mnt is the vfsmount corresponding to @old_dentry (may be NULL).
+  *    @dir contains the inode structure of the parent directory of the new link.
+  *    @new_dentry contains the dentry structure for the new link.
++ *    @new_mnt is the vfsmount corresponding to @new_dentry (may be NULL).
+  *    Return 0 if permission is granted.
+  * @inode_unlink:
+  *    Check the permission to remove a hard link to a file.
+@@ -1362,8 +1364,9 @@ struct security_operations {
+                                   char **name, void **value, size_t *len);
+       int (*inode_create) (struct inode *dir, struct dentry *dentry,
+                            struct vfsmount *mnt, int mode);
+-      int (*inode_link) (struct dentry *old_dentry,
+-                         struct inode *dir, struct dentry *new_dentry);
++      int (*inode_link) (struct dentry *old_dentry, struct vfsmount *old_mnt,
++                         struct inode *dir, struct dentry *new_dentry,
++                         struct vfsmount *new_mnt);
+       int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
+       int (*inode_symlink) (struct inode *dir, struct dentry *dentry,
+                             struct vfsmount *mnt, const char *old_name);
+@@ -1632,8 +1635,9 @@ int security_inode_init_security(struct
+                                 char **name, void **value, size_t *len);
+ int security_inode_create(struct inode *dir, struct dentry *dentry,
+                         struct vfsmount *mnt, int mode);
+-int security_inode_link(struct dentry *old_dentry, struct inode *dir,
+-                       struct dentry *new_dentry);
++int security_inode_link(struct dentry *old_dentry, struct vfsmount *old_mnt,
++                      struct inode *dir, struct dentry *new_dentry,
++                      struct vfsmount *new_mnt);
+ int security_inode_unlink(struct inode *dir, struct dentry *dentry);
+ int security_inode_symlink(struct inode *dir, struct dentry *dentry,
+                          struct vfsmount *mnt, const char *old_name);
+@@ -1987,8 +1991,10 @@ static inline int security_inode_create(
+ }
+ static inline int security_inode_link(struct dentry *old_dentry,
+-                                     struct inode *dir,
+-                                     struct dentry *new_dentry)
++                                    struct vfsmount *old_mnt,
++                                    struct inode *dir,
++                                    struct dentry *new_dentry,
++                                    struct vfsmount *new_mnt)
+ {
+       return 0;
+ }
+--- a/security/capability.c
++++ b/security/capability.c
+@@ -160,8 +160,9 @@ static int cap_inode_create(struct inode
+       return 0;
+ }
+-static int cap_inode_link(struct dentry *old_dentry, struct inode *inode,
+-                        struct dentry *new_dentry)
++static int cap_inode_link(struct dentry *old_dentry, struct vfsmount *old_mnt,
++                        struct inode *inode,
++                        struct dentry *new_dentry, struct vfsmount *new_mnt)
+ {
+       return 0;
+ }
+--- a/security/security.c
++++ b/security/security.c
+@@ -363,12 +363,14 @@ int security_inode_create(struct inode *
+       return security_ops->inode_create(dir, dentry, mnt, mode);
+ }
+-int security_inode_link(struct dentry *old_dentry, struct inode *dir,
+-                       struct dentry *new_dentry)
++int security_inode_link(struct dentry *old_dentry, struct vfsmount *old_mnt,
++                      struct inode *dir, struct dentry *new_dentry,
++                      struct vfsmount *new_mnt)
+ {
+       if (unlikely(IS_PRIVATE(old_dentry->d_inode)))
+               return 0;
+-      return security_ops->inode_link(old_dentry, dir, new_dentry);
++      return security_ops->inode_link(old_dentry, old_mnt, dir,
++                                       new_dentry, new_mnt);
+ }
+ int security_inode_unlink(struct inode *dir, struct dentry *dentry)
+--- a/security/selinux/hooks.c
++++ b/security/selinux/hooks.c
+@@ -2572,11 +2572,16 @@ static int selinux_inode_create(struct i
+       return may_create(dir, dentry, SECCLASS_FILE);
+ }
+-static int selinux_inode_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
++static int selinux_inode_link(struct dentry *old_dentry,
++                            struct vfsmount *old_mnt,
++                            struct inode *dir,
++                            struct dentry *new_dentry,
++                            struct vfsmount *new_mnt)
+ {
+       int rc;
+-      rc = secondary_ops->inode_link(old_dentry, dir, new_dentry);
++      rc = secondary_ops->inode_link(old_dentry, old_mnt, dir, new_dentry,
++                                     new_mnt);
+       if (rc)
+               return rc;
+       return may_link(dir, old_dentry, MAY_LINK);
+--- a/security/smack/smack_lsm.c
++++ b/security/smack/smack_lsm.c
+@@ -432,8 +432,9 @@ static int smack_inode_init_security(str
+  *
+  * Returns 0 if access is permitted, an error code otherwise
+  */
+-static int smack_inode_link(struct dentry *old_dentry, struct inode *dir,
+-                          struct dentry *new_dentry)
++static int smack_inode_link(struct dentry *old_dentry, struct vfsmount *old_mnt,
++                          struct inode *dir,
++                          struct dentry *new_dentry, struct vfsmount *new_mnt)
+ {
+       int rc;
+       char *isp;