mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-06 09:21:00 +01:00
105 lines
3.6 KiB
Diff
105 lines
3.6 KiB
Diff
From: Tony Jones <tonyj@suse.de>
|
|
Subject: Pass struct vfsmount to the inode_listxattr 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/xattr.c | 2 +-
|
|
include/linux/security.h | 9 +++++----
|
|
security/dummy.c | 2 +-
|
|
security/security.c | 4 ++--
|
|
security/selinux/hooks.c | 2 +-
|
|
5 files changed, 10 insertions(+), 9 deletions(-)
|
|
|
|
--- a/fs/xattr.c
|
|
+++ b/fs/xattr.c
|
|
@@ -148,7 +148,7 @@ vfs_listxattr(struct dentry *dentry, str
|
|
struct inode *inode = dentry->d_inode;
|
|
ssize_t error;
|
|
|
|
- error = security_inode_listxattr(dentry);
|
|
+ error = security_inode_listxattr(dentry, mnt);
|
|
if (error)
|
|
return error;
|
|
error = -EOPNOTSUPP;
|
|
--- a/include/linux/security.h
|
|
+++ b/include/linux/security.h
|
|
@@ -409,7 +409,7 @@ struct request_sock;
|
|
* Return 0 if permission is granted.
|
|
* @inode_listxattr:
|
|
* Check permission before obtaining the list of extended attribute
|
|
- * names for @dentry.
|
|
+ * names for @dentry and @mnt.
|
|
* Return 0 if permission is granted.
|
|
* @inode_removexattr:
|
|
* Check permission before removing the extended attribute
|
|
@@ -1293,7 +1293,7 @@ struct security_operations {
|
|
size_t size, int flags);
|
|
int (*inode_getxattr) (struct dentry *dentry, struct vfsmount *mnt,
|
|
char *name);
|
|
- int (*inode_listxattr) (struct dentry *dentry);
|
|
+ int (*inode_listxattr) (struct dentry *dentry, struct vfsmount *mnt);
|
|
int (*inode_removexattr) (struct dentry *dentry, char *name);
|
|
int (*inode_need_killpriv) (struct dentry *dentry);
|
|
int (*inode_killpriv) (struct dentry *dentry);
|
|
@@ -1557,7 +1557,7 @@ void security_inode_post_setxattr(struct
|
|
int flags);
|
|
int security_inode_getxattr(struct dentry *dentry, struct vfsmount *mnt,
|
|
char *name);
|
|
-int security_inode_listxattr(struct dentry *dentry);
|
|
+int security_inode_listxattr(struct dentry *dentry, struct vfsmount *mnt);
|
|
int security_inode_removexattr(struct dentry *dentry, char *name);
|
|
int security_inode_need_killpriv(struct dentry *dentry);
|
|
int security_inode_killpriv(struct dentry *dentry);
|
|
@@ -1962,7 +1962,8 @@ static inline int security_inode_getxatt
|
|
return 0;
|
|
}
|
|
|
|
-static inline int security_inode_listxattr (struct dentry *dentry)
|
|
+static inline int security_inode_listxattr (struct dentry *dentry,
|
|
+ struct vfsmount *mnt)
|
|
{
|
|
return 0;
|
|
}
|
|
--- a/security/dummy.c
|
|
+++ b/security/dummy.c
|
|
@@ -371,7 +371,7 @@ static int dummy_inode_getxattr (struct
|
|
return 0;
|
|
}
|
|
|
|
-static int dummy_inode_listxattr (struct dentry *dentry)
|
|
+static int dummy_inode_listxattr (struct dentry *dentry, struct vfsmount *mnt)
|
|
{
|
|
return 0;
|
|
}
|
|
--- a/security/security.c
|
|
+++ b/security/security.c
|
|
@@ -466,11 +466,11 @@ int security_inode_getxattr(struct dentr
|
|
return security_ops->inode_getxattr(dentry, mnt, name);
|
|
}
|
|
|
|
-int security_inode_listxattr(struct dentry *dentry)
|
|
+int security_inode_listxattr(struct dentry *dentry, struct vfsmount *mnt)
|
|
{
|
|
if (unlikely(IS_PRIVATE(dentry->d_inode)))
|
|
return 0;
|
|
- return security_ops->inode_listxattr(dentry);
|
|
+ return security_ops->inode_listxattr(dentry, mnt);
|
|
}
|
|
|
|
int security_inode_removexattr(struct dentry *dentry, char *name)
|
|
--- a/security/selinux/hooks.c
|
|
+++ b/security/selinux/hooks.c
|
|
@@ -2415,7 +2415,7 @@ static int selinux_inode_getxattr (struc
|
|
return dentry_has_perm(current, NULL, dentry, FILE__GETATTR);
|
|
}
|
|
|
|
-static int selinux_inode_listxattr (struct dentry *dentry)
|
|
+static int selinux_inode_listxattr (struct dentry *dentry, struct vfsmount *mnt)
|
|
{
|
|
return dentry_has_perm(current, NULL, dentry, FILE__GETATTR);
|
|
}
|