]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.apparmor/file-handle-ops.diff
Added missing Xen Kernel Patches which were not commited because
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.apparmor / file-handle-ops.diff
diff --git a/src/patches/suse-2.6.27.31/patches.apparmor/file-handle-ops.diff b/src/patches/suse-2.6.27.31/patches.apparmor/file-handle-ops.diff
new file mode 100644 (file)
index 0000000..2e921f9
--- /dev/null
@@ -0,0 +1,84 @@
+From: Andreas Gruenbacher <agruen@suse.de>
+Subject: Enable LSM hooks to distinguish operations on file descriptors from operations on pathnames
+
+Struct iattr already contains ia_file since commit cc4e69de from 
+Miklos (which is related to commit befc649c). Use this to pass
+struct file down the setattr hooks. This allows LSMs to distinguish
+operations on file descriptors from operations on paths.
+
+Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
+Signed-off-by: John Johansen <jjohansen@suse.de>
+Cc: Miklos Szeredi <mszeredi@suse.cz>
+
+---
+ fs/nfsd/vfs.c |   12 +++++++-----
+ fs/open.c     |    5 ++++-
+ 2 files changed, 11 insertions(+), 6 deletions(-)
+
+--- a/fs/nfsd/vfs.c
++++ b/fs/nfsd/vfs.c
+@@ -425,7 +425,7 @@ static ssize_t nfsd_getxattr(struct dent
+ {
+       ssize_t buflen;
+-      buflen = vfs_getxattr(dentry, mnt, key, NULL, 0);
++      buflen = vfs_getxattr(dentry, mnt, key, NULL, 0, NULL);
+       if (buflen <= 0)
+               return buflen;
+@@ -433,7 +433,7 @@ static ssize_t nfsd_getxattr(struct dent
+       if (!*buf)
+               return -ENOMEM;
+-      return vfs_getxattr(dentry, mnt, key, *buf, buflen);
++      return vfs_getxattr(dentry, mnt, key, *buf, buflen, NULL);
+ }
+ #endif
+@@ -459,7 +459,7 @@ set_nfsv4_acl_one(struct dentry *dentry,
+               goto out;
+       }
+-      error = vfs_setxattr(dentry, mnt, key, buf, len, 0);
++      error = vfs_setxattr(dentry, mnt, key, buf, len, 0, NULL);
+ out:
+       kfree(buf);
+       return error;
+@@ -2133,12 +2133,14 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i
+       if (error)
+               goto getout;
+       if (size)
+-              error = vfs_setxattr(fhp->fh_dentry, mnt, name, value, size,0);
++              error = vfs_setxattr(fhp->fh_dentry, mnt, name, value, size, 0,
++                                   NULL);
+       else {
+               if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT)
+                       error = 0;
+               else {
+-                      error = vfs_removexattr(fhp->fh_dentry, mnt, name);
++                      error = vfs_removexattr(fhp->fh_dentry, mnt, name,
++                                              NULL);
+                       if (error == -ENODATA)
+                               error = 0;
+               }
+--- a/fs/open.c
++++ b/fs/open.c
+@@ -623,7 +623,7 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd
+       if (mode == (mode_t) -1)
+               mode = inode->i_mode;
+       newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
+-      newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
++      newattrs.ia_valid = ATTR_MODE | ATTR_CTIME | ATTR_FILE;
+       err = fnotify_change(dentry, file->f_path.mnt, &newattrs, file);
+       mutex_unlock(&inode->i_mutex);
+       mnt_drop_write(file->f_path.mnt);
+@@ -686,6 +686,9 @@ static int chown_common(struct dentry * 
+       if (!S_ISDIR(inode->i_mode))
+               newattrs.ia_valid |=
+                       ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
++      if (file)
++              newattrs.ia_valid |= ATTR_FILE;
++
+       mutex_lock(&inode->i_mutex);
+       error = fnotify_change(dentry, mnt, &newattrs, file);
+       mutex_unlock(&inode->i_mutex);