|
@@ -919,6 +919,8 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
|
|
|
int cap_inode_setxattr(struct dentry *dentry, const char *name,
|
|
|
const void *value, size_t size, int flags)
|
|
|
{
|
|
|
+ struct user_namespace *user_ns = dentry->d_sb->s_user_ns;
|
|
|
+
|
|
|
/* Ignore non-security xattrs */
|
|
|
if (strncmp(name, XATTR_SECURITY_PREFIX,
|
|
|
sizeof(XATTR_SECURITY_PREFIX) - 1) != 0)
|
|
@@ -931,7 +933,7 @@ int cap_inode_setxattr(struct dentry *dentry, const char *name,
|
|
|
if (strcmp(name, XATTR_NAME_CAPS) == 0)
|
|
|
return 0;
|
|
|
|
|
|
- if (!capable(CAP_SYS_ADMIN))
|
|
|
+ if (!ns_capable(user_ns, CAP_SYS_ADMIN))
|
|
|
return -EPERM;
|
|
|
return 0;
|
|
|
}
|
|
@@ -949,6 +951,8 @@ int cap_inode_setxattr(struct dentry *dentry, const char *name,
|
|
|
*/
|
|
|
int cap_inode_removexattr(struct dentry *dentry, const char *name)
|
|
|
{
|
|
|
+ struct user_namespace *user_ns = dentry->d_sb->s_user_ns;
|
|
|
+
|
|
|
/* Ignore non-security xattrs */
|
|
|
if (strncmp(name, XATTR_SECURITY_PREFIX,
|
|
|
sizeof(XATTR_SECURITY_PREFIX) - 1) != 0)
|
|
@@ -964,7 +968,7 @@ int cap_inode_removexattr(struct dentry *dentry, const char *name)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- if (!capable(CAP_SYS_ADMIN))
|
|
|
+ if (!ns_capable(user_ns, CAP_SYS_ADMIN))
|
|
|
return -EPERM;
|
|
|
return 0;
|
|
|
}
|