1
From: Tony Jones <tonyj@suse.de>
2
Subject: Pass struct vfsmount to the inode_getxattr LSM hook
4
This is needed for computing pathnames in the AppArmor LSM.
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>
12
include/linux/security.h | 11 +++++++----
13
security/dummy.c | 3 ++-
14
security/security.c | 5 +++--
15
security/selinux/hooks.c | 3 ++-
16
5 files changed, 15 insertions(+), 9 deletions(-)
20
@@ -141,7 +141,7 @@ vfs_getxattr(struct dentry *dentry, stru
24
- error = security_inode_getxattr(dentry, name);
25
+ error = security_inode_getxattr(dentry, mnt, name);
29
--- a/include/linux/security.h
30
+++ b/include/linux/security.h
31
@@ -450,7 +450,7 @@ static inline void security_free_mnt_opt
32
* @value identified by @name for @dentry and @mnt.
34
* Check permission before obtaining the extended attributes
35
- * identified by @name for @dentry.
36
+ * identified by @name for @dentry and @mnt.
37
* Return 0 if permission is granted.
39
* Check permission before obtaining the list of extended attribute
40
@@ -1401,7 +1401,8 @@ struct security_operations {
42
const char *name, const void *value,
43
size_t size, int flags);
44
- int (*inode_getxattr) (struct dentry *dentry, const char *name);
45
+ int (*inode_getxattr) (struct dentry *dentry, struct vfsmount *mnt,
47
int (*inode_listxattr) (struct dentry *dentry);
48
int (*inode_removexattr) (struct dentry *dentry, const char *name);
49
int (*inode_need_killpriv) (struct dentry *dentry);
50
@@ -1682,7 +1683,8 @@ int security_inode_setxattr(struct dentr
51
void security_inode_post_setxattr(struct dentry *dentry, struct vfsmount *mnt,
52
const char *name, const void *value,
53
size_t size, int flags);
54
-int security_inode_getxattr(struct dentry *dentry, const char *name);
55
+int security_inode_getxattr(struct dentry *dentry, struct vfsmount *mnt,
57
int security_inode_listxattr(struct dentry *dentry);
58
int security_inode_removexattr(struct dentry *dentry, const char *name);
59
int security_inode_need_killpriv(struct dentry *dentry);
60
@@ -2114,7 +2116,8 @@ static inline void security_inode_post_s
63
static inline int security_inode_getxattr(struct dentry *dentry,
65
+ struct vfsmount *mnt,
70
--- a/security/dummy.c
71
+++ b/security/dummy.c
72
@@ -392,7 +392,8 @@ static void dummy_inode_post_setxattr (s
76
-static int dummy_inode_getxattr (struct dentry *dentry, const char *name)
77
+static int dummy_inode_getxattr (struct dentry *dentry, struct vfsmount *mnt,
82
--- a/security/security.c
83
+++ b/security/security.c
84
@@ -520,11 +520,12 @@ void security_inode_post_setxattr(struct
88
-int security_inode_getxattr(struct dentry *dentry, const char *name)
89
+int security_inode_getxattr(struct dentry *dentry, struct vfsmount *mnt,
92
if (unlikely(IS_PRIVATE(dentry->d_inode)))
94
- return security_ops->inode_getxattr(dentry, name);
95
+ return security_ops->inode_getxattr(dentry, mnt, name);
98
int security_inode_listxattr(struct dentry *dentry)
99
--- a/security/selinux/hooks.c
100
+++ b/security/selinux/hooks.c
101
@@ -2732,7 +2732,8 @@ static void selinux_inode_post_setxattr(
105
-static int selinux_inode_getxattr(struct dentry *dentry, const char *name)
106
+static int selinux_inode_getxattr(struct dentry *dentry, struct vfsmount *mnt,
109
return dentry_has_perm(current, NULL, dentry, FILE__GETATTR);