apparmor/kernel-patches/for-mainline/security-removexattr.diff

128 lines
4.9 KiB
Diff
Raw Normal View History

2007-04-05 10:04:00 +00:00
From: Tony Jones <tonyj@suse.de>
Subject: Pass struct vfsmount to the inode_removexattr 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>
2007-04-05 10:04:00 +00:00
---
fs/xattr.c | 2 +-
2008-07-02 20:24:33 +00:00
include/linux/security.h | 14 +++++++++-----
2007-04-05 10:04:00 +00:00
security/commoncap.c | 3 ++-
security/dummy.c | 3 ++-
2007-11-19 23:18:48 +00:00
security/security.c | 5 +++--
2007-04-05 10:04:00 +00:00
security/selinux/hooks.c | 3 ++-
2008-07-02 20:24:33 +00:00
6 files changed, 19 insertions(+), 11 deletions(-)
2007-04-05 10:04:00 +00:00
--- a/fs/xattr.c
+++ b/fs/xattr.c
2008-07-02 20:24:33 +00:00
@@ -202,7 +202,7 @@ vfs_removexattr(struct dentry *dentry, s
if (error)
return error;
- error = security_inode_removexattr(dentry, name);
+ error = security_inode_removexattr(dentry, mnt, name);
if (error)
return error;
--- a/include/linux/security.h
+++ b/include/linux/security.h
2008-07-02 20:24:33 +00:00
@@ -56,7 +56,8 @@ extern int cap_bprm_secureexec(struct li
extern int cap_inode_setxattr(struct dentry *dentry, struct vfsmount *mnt,
const char *name, const void *value, size_t size,
int flags);
-extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
+extern int cap_inode_removexattr(struct dentry *dentry, struct vfsmount *mnt,
+ const char *name);
2007-11-19 23:18:48 +00:00
extern int cap_inode_need_killpriv(struct dentry *dentry);
extern int cap_inode_killpriv(struct dentry *dentry);
2008-07-02 20:24:33 +00:00
extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
@@ -1404,7 +1405,8 @@ struct security_operations {
int (*inode_getxattr) (struct dentry *dentry, struct vfsmount *mnt,
2008-07-02 20:24:33 +00:00
const char *name);
int (*inode_listxattr) (struct dentry *dentry, struct vfsmount *mnt);
2008-07-02 20:24:33 +00:00
- int (*inode_removexattr) (struct dentry *dentry, const char *name);
+ int (*inode_removexattr) (struct dentry *dentry, struct vfsmount *mnt,
2008-07-02 20:24:33 +00:00
+ const char *name);
2007-11-19 23:18:48 +00:00
int (*inode_need_killpriv) (struct dentry *dentry);
int (*inode_killpriv) (struct dentry *dentry);
2008-07-02 20:24:33 +00:00
int (*inode_getsecurity) (const struct inode *inode, const char *name, void **buffer, bool alloc);
@@ -1686,7 +1688,8 @@ void security_inode_post_setxattr(struct
2007-11-19 23:18:48 +00:00
int security_inode_getxattr(struct dentry *dentry, struct vfsmount *mnt,
2008-07-02 20:24:33 +00:00
const char *name);
2007-11-19 23:18:48 +00:00
int security_inode_listxattr(struct dentry *dentry, struct vfsmount *mnt);
2008-07-02 20:24:33 +00:00
-int security_inode_removexattr(struct dentry *dentry, const char *name);
2007-11-19 23:18:48 +00:00
+int security_inode_removexattr(struct dentry *dentry, struct vfsmount *mnt,
2008-07-02 20:24:33 +00:00
+ const char *name);
2007-11-19 23:18:48 +00:00
int security_inode_need_killpriv(struct dentry *dentry);
int security_inode_killpriv(struct dentry *dentry);
2008-07-02 20:24:33 +00:00
int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc);
@@ -2129,9 +2132,10 @@ static inline int security_inode_listxat
}
2008-07-02 20:24:33 +00:00
static inline int security_inode_removexattr(struct dentry *dentry,
- const char *name)
+ struct vfsmount *mnt,
+ const char *name)
{
- return cap_inode_removexattr(dentry, name);
+ return cap_inode_removexattr(dentry, mnt, name);
}
2007-11-19 23:18:48 +00:00
static inline int security_inode_need_killpriv(struct dentry *dentry)
--- a/security/commoncap.c
+++ b/security/commoncap.c
2008-07-02 20:24:33 +00:00
@@ -398,7 +398,8 @@ int cap_inode_setxattr(struct dentry *de
return 0;
}
2008-07-02 20:24:33 +00:00
-int cap_inode_removexattr(struct dentry *dentry, const char *name)
+int cap_inode_removexattr(struct dentry *dentry, struct vfsmount *mnt,
2008-07-02 20:24:33 +00:00
+ const char *name)
{
2007-11-19 23:18:48 +00:00
if (!strcmp(name, XATTR_NAME_CAPS)) {
if (!capable(CAP_SETFCAP))
--- a/security/dummy.c
+++ b/security/dummy.c
2008-07-02 20:24:33 +00:00
@@ -403,7 +403,8 @@ static int dummy_inode_listxattr (struct
return 0;
}
2008-07-02 20:24:33 +00:00
-static int dummy_inode_removexattr (struct dentry *dentry, const char *name)
+static int dummy_inode_removexattr (struct dentry *dentry, struct vfsmount *mnt,
2008-07-02 20:24:33 +00:00
+ const char *name)
{
if (!strncmp(name, XATTR_SECURITY_PREFIX,
sizeof(XATTR_SECURITY_PREFIX) - 1) &&
2007-11-19 23:18:48 +00:00
--- a/security/security.c
+++ b/security/security.c
2008-07-02 20:24:33 +00:00
@@ -535,11 +535,12 @@ int security_inode_listxattr(struct dent
2007-11-19 23:18:48 +00:00
return security_ops->inode_listxattr(dentry, mnt);
}
2008-07-02 20:24:33 +00:00
-int security_inode_removexattr(struct dentry *dentry, const char *name)
2007-11-19 23:18:48 +00:00
+int security_inode_removexattr(struct dentry *dentry, struct vfsmount *mnt,
2008-07-02 20:24:33 +00:00
+ const char *name)
2007-11-19 23:18:48 +00:00
{
if (unlikely(IS_PRIVATE(dentry->d_inode)))
return 0;
- return security_ops->inode_removexattr(dentry, name);
+ return security_ops->inode_removexattr(dentry, mnt, name);
}
int security_inode_need_killpriv(struct dentry *dentry)
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
2008-07-02 20:24:33 +00:00
@@ -2743,7 +2743,8 @@ static int selinux_inode_listxattr(struc
return dentry_has_perm(current, NULL, dentry, FILE__GETATTR);
}
2008-07-02 20:24:33 +00:00
-static int selinux_inode_removexattr(struct dentry *dentry, const char *name)
+static int selinux_inode_removexattr(struct dentry *dentry,
+ struct vfsmount *mnt, const char *name)
{
2007-11-19 23:18:48 +00:00
if (strcmp(name, XATTR_NAME_SELINUX))
return selinux_inode_setotherxattr(dentry, name);