mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
xattr: handle idmapped mounts
When interacting with extended attributes the vfs verifies that the caller is privileged over the inode with which the extended attribute is associated. For posix access and posix default extended attributes a uid or gid can be stored on-disk. Let the functions handle posix extended attributes on idmapped mounts. If the inode is accessed through an idmapped mount we need to map it according to the mount's user namespace. Afterwards the checks are identical to non-idmapped mounts. This has no effect for e.g. security xattrs since they don't store uids or gids and don't perform permission checks on them like posix acls do. Link: https://lore.kernel.org/r/20210121131959.646623-10-christian.brauner@ubuntu.com Cc: Christoph Hellwig <hch@lst.de> Cc: David Howells <dhowells@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: James Morris <jamorris@linux.microsoft.com> Signed-off-by: Tycho Andersen <tycho@tycho.pizza> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
committed by
Christian Brauner
parent
e65ce2a50c
commit
c7c7a1a18a
@@ -16,6 +16,7 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/user_namespace.h>
|
||||
#include <uapi/linux/xattr.h>
|
||||
|
||||
struct inode;
|
||||
@@ -49,18 +50,26 @@ struct xattr {
|
||||
};
|
||||
|
||||
ssize_t __vfs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
|
||||
ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
|
||||
ssize_t vfs_getxattr(struct user_namespace *, struct dentry *, const char *,
|
||||
void *, size_t);
|
||||
ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
|
||||
int __vfs_setxattr(struct dentry *, struct inode *, const char *, const void *, size_t, int);
|
||||
int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
|
||||
int __vfs_setxattr_locked(struct dentry *, const char *, const void *, size_t, int, struct inode **);
|
||||
int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
|
||||
int __vfs_removexattr(struct dentry *, const char *);
|
||||
int __vfs_removexattr_locked(struct dentry *, const char *, struct inode **);
|
||||
int vfs_removexattr(struct dentry *, const char *);
|
||||
int __vfs_setxattr(struct user_namespace *, struct dentry *, struct inode *,
|
||||
const char *, const void *, size_t, int);
|
||||
int __vfs_setxattr_noperm(struct user_namespace *, struct dentry *,
|
||||
const char *, const void *, size_t, int);
|
||||
int __vfs_setxattr_locked(struct user_namespace *, struct dentry *,
|
||||
const char *, const void *, size_t, int,
|
||||
struct inode **);
|
||||
int vfs_setxattr(struct user_namespace *, struct dentry *, const char *,
|
||||
const void *, size_t, int);
|
||||
int __vfs_removexattr(struct user_namespace *, struct dentry *, const char *);
|
||||
int __vfs_removexattr_locked(struct user_namespace *, struct dentry *,
|
||||
const char *, struct inode **);
|
||||
int vfs_removexattr(struct user_namespace *, struct dentry *, const char *);
|
||||
|
||||
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
|
||||
ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
|
||||
ssize_t vfs_getxattr_alloc(struct user_namespace *mnt_userns,
|
||||
struct dentry *dentry, const char *name,
|
||||
char **xattr_value, size_t size, gfp_t flags);
|
||||
|
||||
int xattr_supported_namespace(struct inode *inode, const char *prefix);
|
||||
|
||||
Reference in New Issue
Block a user