2007-04-05 10:04:00 +00:00
|
|
|
From: Tony Jones <tonyj@suse.de>
|
|
|
|
Subject: Pass struct vfsmount to the inode_getxattr LSM hook
|
|
|
|
|
|
|
|
This is needed for computing pathnames in the AppArmor LSM.
|
2007-01-10 06:33:09 +00:00
|
|
|
|
|
|
|
Signed-off-by: Tony Jones <tonyj@suse.de>
|
|
|
|
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
|
2007-04-03 12:04:05 +00:00
|
|
|
Signed-off-by: John Johansen <jjohansen@suse.de>
|
2007-01-10 06:33:09 +00:00
|
|
|
|
2007-04-05 10:04:00 +00:00
|
|
|
---
|
|
|
|
fs/xattr.c | 2 +-
|
|
|
|
include/linux/security.h | 13 ++++++++-----
|
|
|
|
security/dummy.c | 3 ++-
|
|
|
|
security/selinux/hooks.c | 3 ++-
|
|
|
|
4 files changed, 13 insertions(+), 8 deletions(-)
|
|
|
|
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/fs/xattr.c
|
|
|
|
+++ b/fs/xattr.c
|
2007-05-09 12:51:20 +00:00
|
|
|
@@ -116,7 +116,7 @@ vfs_getxattr(struct dentry *dentry, stru
|
2007-01-10 06:33:09 +00:00
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
- error = security_inode_getxattr(dentry, name);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ error = security_inode_getxattr(dentry, mnt, name);
|
2007-01-10 06:33:09 +00:00
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/include/linux/security.h
|
|
|
|
+++ b/include/linux/security.h
|
2007-01-17 07:12:32 +00:00
|
|
|
@@ -391,7 +391,7 @@ struct request_sock;
|
|
|
|
* @value identified by @name for @dentry and @mnt.
|
|
|
|
* @inode_getxattr:
|
|
|
|
* Check permission before obtaining the extended attributes
|
|
|
|
- * identified by @name for @dentry.
|
2007-02-01 05:28:52 +00:00
|
|
|
+ * identified by @name for @dentry and @mnt.
|
2007-01-17 07:12:32 +00:00
|
|
|
* Return 0 if permission is granted.
|
|
|
|
* @inode_listxattr:
|
|
|
|
* Check permission before obtaining the list of extended attribute
|
2007-02-01 05:28:52 +00:00
|
|
|
@@ -1248,7 +1248,8 @@ struct security_operations {
|
2007-01-17 07:12:32 +00:00
|
|
|
struct vfsmount *mnt,
|
|
|
|
char *name, void *value,
|
2007-01-10 06:33:09 +00:00
|
|
|
size_t size, int flags);
|
|
|
|
- int (*inode_getxattr) (struct dentry *dentry, char *name);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ int (*inode_getxattr) (struct dentry *dentry, struct vfsmount *mnt,
|
2007-01-10 06:33:09 +00:00
|
|
|
+ char *name);
|
|
|
|
int (*inode_listxattr) (struct dentry *dentry);
|
|
|
|
int (*inode_removexattr) (struct dentry *dentry, char *name);
|
|
|
|
const char *(*inode_xattr_getsuffix) (void);
|
2007-02-01 05:28:52 +00:00
|
|
|
@@ -1782,11 +1783,12 @@ static inline void security_inode_post_s
|
2007-01-17 07:12:32 +00:00
|
|
|
security_ops->inode_post_setxattr (dentry, mnt, name, value, size, flags);
|
2007-01-10 06:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-static inline int security_inode_getxattr (struct dentry *dentry, char *name)
|
2007-01-17 07:12:32 +00:00
|
|
|
+static inline int security_inode_getxattr (struct dentry *dentry,
|
|
|
|
+ struct vfsmount *mnt, char *name)
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
if (unlikely (IS_PRIVATE (dentry->d_inode)))
|
|
|
|
return 0;
|
|
|
|
- return security_ops->inode_getxattr (dentry, name);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ return security_ops->inode_getxattr (dentry, mnt, name);
|
2007-01-10 06:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int security_inode_listxattr (struct dentry *dentry)
|
2007-02-01 05:28:52 +00:00
|
|
|
@@ -2487,7 +2489,8 @@ static inline void security_inode_post_s
|
2007-01-17 07:12:32 +00:00
|
|
|
int flags)
|
2007-01-10 06:33:09 +00:00
|
|
|
{ }
|
|
|
|
|
|
|
|
-static inline int security_inode_getxattr (struct dentry *dentry, char *name)
|
2007-01-17 07:12:32 +00:00
|
|
|
+static inline int security_inode_getxattr (struct dentry *dentry,
|
|
|
|
+ struct vfsmount *mnt, char *name)
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/security/dummy.c
|
|
|
|
+++ b/security/dummy.c
|
2007-01-17 07:12:32 +00:00
|
|
|
@@ -368,7 +368,8 @@ static void dummy_inode_post_setxattr (s
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
-static int dummy_inode_getxattr (struct dentry *dentry, char *name)
|
2007-01-17 07:12:32 +00:00
|
|
|
+static int dummy_inode_getxattr (struct dentry *dentry,
|
|
|
|
+ struct vfsmount *mnt, char *name)
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/security/selinux/hooks.c
|
|
|
|
+++ b/security/selinux/hooks.c
|
2007-05-09 12:51:20 +00:00
|
|
|
@@ -2393,7 +2393,8 @@ static void selinux_inode_post_setxattr(
|
2007-01-10 06:33:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
-static int selinux_inode_getxattr (struct dentry *dentry, char *name)
|
2007-01-17 07:12:32 +00:00
|
|
|
+static int selinux_inode_getxattr (struct dentry *dentry, struct vfsmount *mnt,
|
2007-01-10 06:33:09 +00:00
|
|
|
+ char *name)
|
|
|
|
{
|
|
|
|
return dentry_has_perm(current, NULL, dentry, FILE__GETATTR);
|
|
|
|
}
|