Add flags option to get xattr method paired to __vfs_getxattr
Subsystems (36)
PATCH v5 1/1 Add flags option to get xattr method paired to __vfs_getxattr
Replace arguments for get and set xattr methods, and __vfs_getxattr and __vfs_setaxtr functions with a reference to the following argument structure:
struct xattr_gs_args {
struct dentry *dentry;
struct inode *inode;
const char *name;
union {
void *buffer;
const void *value;
};
size_t size;
int flags;
};Which in effect adds a flags option to the get method and __vfs_getxattr function.
Add a flag option to get xattr method that has bit flag of XATTR_NOSECURITY passed to it. XATTR_NOSECURITY is generally then set in the __vfs_getxattr path when called by security infrastructure.
This handles the case of a union filesystem driver that is being requested by the security layer to report back the xattr data.
For the use case where access is to be blocked by the security layer.
The path then could be security(dentry) -> __vfs_getxattr({dentry...XATTR_NOSECURITY}) -> handler->get({dentry...XATTR_NOSECURITY}) -> __vfs_getxattr({lower_dentry...XATTR_NOSECURITY}) -> lower_handler->get({lower_dentry...XATTR_NOSECURITY}) which would report back through the chain data and success as expected, the logging security layer at the top would have the data to determine the access permissions and report back the target context that was blocked.
Without the get handler flag, the path on a union filesystem would be the errant security(dentry) -> __vfs_getxattr(dentry) -> handler->get(dentry) -> vfs_getxattr(lower_dentry) -> nested -> security(lower_dentry, log off) -> lower_handler->get(lower_dentry) which would report back through the chain no data, and -EACCES.
For selinux for both cases, this would translate to a correctly determined blocked access. In the first case with this change a correct avc log would be reported, in the second legacy case an incorrect avc log would be reported against an uninitialized u:object_r:unlabeled:s0 context making the logs cosmetically useless for audit2allow.
This patch series is inert and is the wide-spread addition of the flags option for xattr functions, and a replacement of __vfs_getxattr with __vfs_getxattr({...XATTR_NOSECURITY}).
---
v5:
- introduce struct xattr_gs_args for get and set methods, __vfs_getxattr and __vfs_setxattr functions.
- cover a missing spot in ext2.
- switch from snprintf to scnprintf for correctness.
v4:
- ifdef __KERNEL__ around XATTR_NOSECURITY to
keep it colocated in uapi headers.
v3:
- poor aim on ubifs not ubifs_xattr_get, but static xattr_get
v2:
- Missed a spot: ubifs, erofs and afs.
v1:
- Removed from an overlayfs patch set, and made independent. Expect this to be the basis of some security improvements.
--- Documentation/filesystems/Locking | 10 ++- drivers/staging/erofs/xattr.c | 8 +-- fs/9p/acl.c | 37 +++++----- fs/9p/xattr.c | 19 +++-- fs/afs/xattr.c | 110 +++++++++++++---------------- fs/btrfs/xattr.c | 36 +++++----- fs/ceph/xattr.c | 40 +++++------ fs/cifs/xattr.c | 72 +++++++++---------- fs/ecryptfs/crypto.c | 20 +++--- fs/ecryptfs/inode.c | 36 ++++++---- fs/ecryptfs/mmap.c | 39 ++++++----- fs/ext2/xattr_security.c | 16 ++--- fs/ext2/xattr_trusted.c | 15 ++-- fs/ext2/xattr_user.c | 19 +++-- fs/ext4/xattr_security.c | 15 ++-- fs/ext4/xattr_trusted.c | 15 ++-- fs/ext4/xattr_user.c | 19 +++-- fs/f2fs/xattr.c | 42 +++++------ fs/fuse/xattr.c | 23 +++--- fs/gfs2/xattr.c | 18 ++--- fs/hfs/attr.c | 15 ++-- fs/hfsplus/xattr.c | 17 +++-- fs/hfsplus/xattr_security.c | 13 ++-- fs/hfsplus/xattr_trusted.c | 13 ++-- fs/hfsplus/xattr_user.c | 13 ++-- fs/jffs2/security.c | 16 ++--- fs/jffs2/xattr_trusted.c | 16 ++--- fs/jffs2/xattr_user.c | 16 ++--- fs/jfs/xattr.c | 33 ++++----- fs/kernfs/inode.c | 21 +++--- fs/nfs/nfs4proc.c | 28 ++++---- fs/ocfs2/xattr.c | 52 ++++++-------- fs/orangefs/xattr.c | 19 ++--- fs/overlayfs/inode.c | 43 ++++++------ fs/overlayfs/overlayfs.h | 6 +- fs/overlayfs/super.c | 53 ++++++-------- fs/posix_acl.c | 23 +++--- fs/reiserfs/xattr.c | 2 +- fs/reiserfs/xattr_security.c | 22 +++--- fs/reiserfs/xattr_trusted.c | 22 +++--- fs/reiserfs/xattr_user.c | 22 +++--- fs/squashfs/xattr.c | 10 +-- fs/ubifs/xattr.c | 27 ++++--- fs/xattr.c | 112 ++++++++++++++++++------------ fs/xfs/libxfs/xfs_attr.c | 2 +- fs/xfs/libxfs/xfs_attr.h | 2 +- fs/xfs/xfs_xattr.c | 35 +++++----- include/linux/xattr.h | 26 ++++--- include/uapi/linux/xattr.h | 7 +- mm/shmem.c | 21 +++--- net/socket.c | 16 ++--- security/commoncap.c | 29 +++++--- security/integrity/evm/evm_main.c | 11 ++- security/selinux/hooks.c | 28 ++++++-- security/smack/smack_lsm.c | 34 ++++++--- 55 files changed, 715 insertions(+), 719 deletions(-)
Documentation/filesystems/Locking +4 -6
@@ -101,12 +101,10 @@ of the locking scheme for directory operations. ----------------------- xattr_handler operations ----------------------- prototypes: bool (*list)(struct dentry *dentry); - int (*get)(const struct xattr_handler *handler, struct dentry *dentry, - struct inode *inode, const char *name, void *buffer, - size_t size); - int (*set)(const struct xattr_handler *handler, struct dentry *dentry, - struct inode *inode, const char *name, const void *buffer, - size_t size, int flags); + int (*get)(const struct xattr_handler *handler, + struct xattr_gs_flags); + int (*set)(const struct xattr_handler *handler, + struct xattr_gs_flags); locking rules: all may block
drivers/staging/erofs/xattr.c +4 -4
@@ -462,10 +462,9 @@ int erofs_getxattr(struct inode *inode, int index, }static int erofs_xattr_generic_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -struct erofs_sb_info *const sbi =EROFS_I_SB (inode); +struct erofs_sb_info *const sbi =EROFS_I_SB (args->inode);switch (handler->flags) {case EROFS_XATTR_INDEX_USER :
@@ -482,7 +481,8 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,return -EINVAL ; } -return erofs_getxattr (inode, handler->flags, name, buffer, size); +return erofs_getxattr (args->inode, handler->flags, args->name, + args->buffer, args->size); }const struct xattr_handler erofs_xattr_user_handler = {
fs/9p/acl.c +19 -18
@@ -213,56 +213,56 @@ int v9fs_acl_mode(struct inode *dir, umode_t *modep, }static int v9fs_xattr_get_acl (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) {struct v9fs_session_info *v9ses;struct posix_acl *acl;int error; - v9ses =v9fs_dentry2v9ses (dentry); + v9ses =v9fs_dentry2v9ses (args->dentry);/* * We allow set/get/list of acl when access=client is not specified */ if ((v9ses->flags &V9FS_ACCESS_MASK ) !=V9FS_ACCESS_CLIENT ) -return v9fs_xattr_get (dentry, handler->name, buffer, size); +return v9fs_xattr_get (args->dentry, handler->name, + args->buffer, args->size); - acl =v9fs_get_cached_acl (inode, handler->flags); + acl =v9fs_get_cached_acl (args->inode, handler->flags);if (IS_ERR (acl))return PTR_ERR (acl);if (acl ==NULL )return -ENODATA ; - error =posix_acl_to_xattr (&init_user_ns, acl, buffer, size); + error =posix_acl_to_xattr (&init_user_ns, acl, + args->buffer, args->size);posix_acl_release (acl);return error; }static int v9fs_xattr_set_acl (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) {int retval;struct posix_acl *acl;struct v9fs_session_info *v9ses; - v9ses =v9fs_dentry2v9ses (dentry); + v9ses =v9fs_dentry2v9ses (args->dentry);/* * set the attribute on the remote. Without even looking at the * xattr value. We leave it to the server to validate */ if ((v9ses->flags &V9FS_ACCESS_MASK ) !=V9FS_ACCESS_CLIENT ) -return v9fs_xattr_set (dentry, handler->name, value, size, - flags); +return v9fs_xattr_set (args->dentry, handler->name, + args->value, args->size, args->flags);if (S_ISLNK (inode->i_mode))return -EOPNOTSUPP ;if (!inode_owner_or_capable (inode))return -EPERM ; -if (value) { +if (args->value) {/* update the cached acl value */ - acl =posix_acl_from_xattr (&init_user_ns, value, size); + acl =posix_acl_from_xattr (&init_user_ns, + args->value, args->size);if (IS_ERR (acl))return PTR_ERR (acl);else if (acl) {
@@ -289,15 +289,15 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,* update ACL. */ posix_acl_release (old_acl); - value =NULL ; - size =0 ; + args->value =NULL ; + args->size =0 ; } iattr.ia_valid =ATTR_MODE ;/* FIXME should we update ctime ? * What is the following setxattr update the * mode ? */ -v9fs_vfs_setattr_dotl (dentry, &iattr); +v9fs_vfs_setattr_dotl (args->dentry, &iattr); }break ;case ACL_TYPE_DEFAULT :
@@ -309,7 +309,8 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,default :BUG (); } - retval =v9fs_xattr_set (dentry, handler->name, value, size, flags); + retval =v9fs_xattr_set (args->dentry, handler->name, + args->value, args->size, args->flags);if (!retval)set_cached_acl (inode, handler->flags, acl); err_out:
fs/9p/xattr.c +8 -11
@@ -138,22 +138,19 @@ ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) }static int v9fs_xattr_handler_get (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -const char *full_name =xattr_full_name (handler, name); - -return v9fs_xattr_get (dentry, full_name, buffer, size); +return v9fs_xattr_get (args->dentry, +xattr_full_name (handler, args->name), + args->buffer, args->size); }static int v9fs_xattr_handler_set (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -const char *full_name =xattr_full_name (handler, name); - -return v9fs_xattr_set (dentry, full_name, value, size, flags); +return v9fs_xattr_set (args->dentry, +xattr_full_name (handler, args->name), + args->value, args->size, args->flags); }static struct xattr_handler v9fs_xattr_user_handler = {
fs/afs/xattr.c +49 -61
253 lines not on this page · raw message
fs/btrfs/xattr.c +17 -19
@@ -352,33 +352,30 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) }static int btrfs_xattr_handler_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { - name =xattr_full_name (handler, name); -return btrfs_getxattr (inode, name, buffer, size); +return btrfs_getxattr (args->inode, +xattr_full_name (handler, args->name), + args->buffer, args->size); }static int btrfs_xattr_handler_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *buffer, -size_t size,int flags) +struct xattr_gs_args *args) { - name =xattr_full_name (handler, name); -return btrfs_setxattr_trans (inode, name, buffer, size, flags); +return btrfs_setxattr_trans (args->inode, +xattr_full_name (handler, args->name), + args->value, args->size, args->flags); }static int btrfs_xattr_handler_set_prop (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) {int ret;struct btrfs_trans_handle *trans; -struct btrfs_root *root =BTRFS_I (inode)->root; +struct btrfs_root *root =BTRFS_I (args->inode)->root; - name =xattr_full_name (handler, name); - ret =btrfs_validate_prop (name, value, size); + ret =btrfs_validate_prop (xattr_full_name (handler, args->name), + args->value, args->size);if (ret)return ret;
@@ -386,11 +383,12 @@ static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler,if (IS_ERR (trans))return PTR_ERR (trans); - ret =btrfs_set_prop (trans, inode, name, value, size, flags); + ret =btrfs_set_prop (trans, args->inode, args->name, + args->value, args->size, args->flags);if (!ret) { -inode_inc_iversion (inode); - inode->i_ctime =current_time (inode); - ret =btrfs_update_inode (trans, root, inode); +inode_inc_iversion (args->inode); + args->inode->i_ctime =current_time (args->inode); + ret =btrfs_update_inode (trans, root, args->inode);BUG_ON (ret); }
fs/ceph/xattr.c +18 -22
@@ -1170,22 +1170,21 @@ int __ceph_setxattr(struct inode *inode, const char *name, }static int ceph_get_xattr_handler (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,void *value,size_t size) +struct xattr_gs_args *args) { -if (!ceph_is_valid_xattr (name)) +if (!ceph_is_valid_xattr (args->name))return -EOPNOTSUPP ; -return __ceph_getxattr (inode, name, value, size); +return __ceph_getxattr (args->inode, args->name, + args->buffer, args->size); }static int ceph_set_xattr_handler (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -if (!ceph_is_valid_xattr (name)) +if (!ceph_is_valid_xattr (args->name))return -EOPNOTSUPP ; -return __ceph_setxattr (inode, name, value, size, flags); +return __ceph_setxattr (args->inode, args->name, + args->value, args->size, args->flags); }static const struct xattr_handler ceph_other_xattr_handler = {
@@ -1291,25 +1290,22 @@ void ceph_security_invalidate_secctx(struct inode *inode) }static int ceph_xattr_set_security_label (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *key,const void *buf, -size_t buflen,int flags) +struct xattr_gs_args *args) { -if (security_ismaclabel (key)) { -const char *name =xattr_full_name (handler, key); -return __ceph_setxattr (inode, name, buf, buflen, flags); - } +if (security_ismaclabel (args->name)) +return __ceph_setxattr (args->inode, +xattr_full_name (handler, args->name), + args->value, args->size, args->flags);return -EOPNOTSUPP ; }static int ceph_xattr_get_security_label (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *key,void *buf,size_t buflen) +struct xattr_gs_args *args) { -if (security_ismaclabel (key)) { -const char *name =xattr_full_name (handler, key); -return __ceph_getxattr (inode, name, buf, buflen); - } +if (security_ismaclabel (args->name)) +return __ceph_getxattr (args->inode, +xattr_full_name (handler, args->name), + args->buffer, args->size);return -EOPNOTSUPP ; }
fs/cifs/xattr.c +37 -35
186 lines not on this page · raw message
fs/ecryptfs/crypto.c +12 -8
@@ -1114,20 +1114,24 @@ ecryptfs_write_metadata_to_xattr(struct dentry *ecryptfs_dentry, char *page_virt, size_t size) { int rc; -struct dentry *lower_dentry =ecryptfs_dentry_to_lower (ecryptfs_dentry); -struct inode *lower_inode =d_inode (lower_dentry); +struct xattr_gs_args lower = {}; -if (!(lower_inode->i_opflags &IOP_XATTR )) { + lower.dentry =ecryptfs_dentry_to_lower (ecryptfs_dentry); + lower.inode =d_inode (lower.dentry); + +if (!(lower.inode->i_opflags &IOP_XATTR )) { rc = -EOPNOTSUPP ; goto out; } -inode_lock (lower_inode); - rc =__vfs_setxattr (lower_dentry, lower_inode,ECRYPTFS_XATTR_NAME , - page_virt, size,0 ); + lower.name =ECRYPTFS_XATTR_NAME ; + lower.value = page_virt; + lower.size = size; +inode_lock (lower.inode); + rc =__vfs_setxattr (&args);if (!rc && ecryptfs_inode) -fsstack_copy_attr_all (ecryptfs_inode, lower_inode); -inode_unlock (lower_inode); +fsstack_copy_attr_all (ecryptfs_inode, lower.inode); +inode_unlock (lower.inode); out:return rc; }
fs/ecryptfs/inode.c +22 -14
@@ -1009,16 +1009,24 @@ ecryptfs_setxattr(struct dentry *dentry, struct inode *inode,ssize_t ecryptfs_getxattr_lower (struct dentry *lower_dentry,struct inode *lower_inode, -const char *name,void *value,size_t size) +const char *name,void *buffer,size_t size) {int rc; +struct xattr_gs_args args;if (!(lower_inode->i_opflags &IOP_XATTR )) { rc = -EOPNOTSUPP ; goto out; } +memset (&args,0 ,sizeof (args)); + args.dentry = lower_dentry; + args.inode = lower_inode; + args.name = name; + args.buffer = buffer; + args.size = size; + args.flags =XATTR_NOSECURITY ;inode_lock (lower_inode); - rc =__vfs_getxattr (lower_dentry, lower_inode, name, value, size); + rc =__vfs_getxattr (&args);inode_unlock (lower_inode); out:return rc;
@@ -1102,23 +1110,23 @@ const struct inode_operations ecryptfs_main_iops = { };static int ecryptfs_xattr_get (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return ecryptfs_getxattr (dentry, inode, name, buffer, size); +return ecryptfs_getxattr (args->dentry, args->inode, args->name, + args->buffer, args->size); }static int ecryptfs_xattr_set (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,const void *value,size_t size, -int flags) +struct xattr_gs_args *args) { -if (value) -return ecryptfs_setxattr (dentry, inode, name, value, size, flags); -else { -BUG_ON (flags !=XATTR_REPLACE ); -return ecryptfs_removexattr (dentry, inode, name); - } +if (args->value) +return ecryptfs_setxattr (args->dentry, args->inode, args->name, + args->value, args->size, args->flags); +else if (args->flags !=XATTR_REPLACE ) +return -EINVAL ; +else +return ecryptfs_removexattr (args->dentry, args->inode, + args->name); }static const struct xattr_handler ecryptfs_xattr_handler = {
fs/ecryptfs/mmap.c +21 -18
@@ -402,37 +402,40 @@ struct kmem_cache *ecryptfs_xattr_cache;static int ecryptfs_write_inode_size_to_xattr (struct inode *ecryptfs_inode) { -ssize_t size; -void *xattr_virt; -struct dentry *lower_dentry = -ecryptfs_inode_to_private (ecryptfs_inode)->lower_file->f_path.dentry; -struct inode *lower_inode =d_inode (lower_dentry); +struct xattr_gs_args args;int rc; -if (!(lower_inode->i_opflags &IOP_XATTR )) { +memset (&args,0 ,sizeof (args)); + args.dentry =ecryptfs_inode_to_private (ecryptfs_inode)-> + lower_file->f_path.dentry; + args.inode =d_inode (args.dentry); +if (!(args.inode->i_opflags &IOP_XATTR )) {printk (KERN_WARNING "No support for setting xattr in lower filesystem\n" ); rc = -ENOSYS ; goto out; } - xattr_virt =kmem_cache_alloc (ecryptfs_xattr_cache,GFP_KERNEL ); -if (!xattr_virt) { + args.buffer =kmem_cache_alloc (ecryptfs_xattr_cache,GFP_KERNEL ); +if (!args.buffer) { rc = -ENOMEM ; goto out; } -inode_lock (lower_inode); - size =__vfs_getxattr (lower_dentry, lower_inode,ECRYPTFS_XATTR_NAME , - xattr_virt,PAGE_SIZE ); -if (size <0 ) - size =8 ; -put_unaligned_be64 (i_size_read (ecryptfs_inode), xattr_virt); - rc =__vfs_setxattr (lower_dentry, lower_inode,ECRYPTFS_XATTR_NAME , - xattr_virt, size,0 ); -inode_unlock (lower_inode); + args.name =ECRYPTFS_XATTR_NAME ; + args.size =PAGE_SIZE ; + args.flags =XATTR_NOSECURITY ; +inode_lock (args.inode); + args.size =__vfs_getxattr (&args); +if (args.size <0 ) + args.size =8 ; +put_unaligned_be64 (i_size_read (ecryptfs_inode), args.buffer); + args.flags =0 ; + args.value = args.buffer; + rc =__vfs_setxattr (&args); +inode_unlock (args.inode);if (rc)printk (KERN_ERR "Error whilst attempting to write inode size " "to lower file xattr; rc = [%d]\n" , rc); -kmem_cache_free (ecryptfs_xattr_cache, xattr_virt); +kmem_cache_free (ecryptfs_xattr_cache, args.buffer); out:return rc; }
fs/ext2/xattr_security.c +7 -9
@@ -10,21 +10,19 @@static int ext2_xattr_security_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return ext2_xattr_get (inode,EXT2_XATTR_INDEX_SECURITY , name, - buffer, size); +return ext2_xattr_get (args->inode,EXT2_XATTR_INDEX_SECURITY , + args->name, args->buffer, args->size); }static int ext2_xattr_security_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -return ext2_xattr_set (inode,EXT2_XATTR_INDEX_SECURITY , name, - value, size, flags); +return ext2_xattr_set (args->inode,EXT2_XATTR_INDEX_SECURITY , + args->name, args->value, args->size, + args->flags); } static int ext2_initxattrs(struct inode *inode, const struct xattr *xattr_array,
fs/ext2/xattr_trusted.c +6 -9
@@ -17,21 +17,18 @@ ext2_xattr_trusted_list(struct dentry *dentry)static int ext2_xattr_trusted_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return ext2_xattr_get (inode,EXT2_XATTR_INDEX_TRUSTED , name, - buffer, size); +return ext2_xattr_get (args->inode,EXT2_XATTR_INDEX_TRUSTED , args->name, + args->buffer, args->size); }static int ext2_xattr_trusted_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -return ext2_xattr_set (inode,EXT2_XATTR_INDEX_TRUSTED , name, - value, size, flags); +return ext2_xattr_set (args->inode,EXT2_XATTR_INDEX_TRUSTED , args->name, + args->value, args->size, args->flags); }const struct xattr_handler ext2_xattr_trusted_handler = {
fs/ext2/xattr_user.c +8 -11
@@ -19,26 +19,23 @@ ext2_xattr_user_list(struct dentry *dentry)static int ext2_xattr_user_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -if (!test_opt (inode->i_sb,XATTR_USER )) +if (!test_opt (args->inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext2_xattr_get (inode,EXT2_XATTR_INDEX_USER , - name, buffer, size); +return ext2_xattr_get (args->inode,EXT2_XATTR_INDEX_USER , args->name, + args->buffer, args->size); }static int ext2_xattr_user_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -if (!test_opt (inode->i_sb,XATTR_USER )) +if (!test_opt (args->inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext2_xattr_set (inode,EXT2_XATTR_INDEX_USER , - name, value, size, flags); +return ext2_xattr_set (args->inode,EXT2_XATTR_INDEX_USER , args->name, + args->value, args->size, args->flags); }const struct xattr_handler ext2_xattr_user_handler = {
fs/ext4/xattr_security.c +6 -9
@@ -14,21 +14,18 @@static int ext4_xattr_security_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return ext4_xattr_get (inode,EXT4_XATTR_INDEX_SECURITY , - name, buffer, size); +return ext4_xattr_get (args->inode,EXT4_XATTR_INDEX_SECURITY , + args->name, args->buffer, args->size); }static int ext4_xattr_security_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -return ext4_xattr_set (inode,EXT4_XATTR_INDEX_SECURITY , - name, value, size, flags); +return ext4_xattr_set (args->inode,EXT4_XATTR_INDEX_SECURITY , + args->name, args->value, args->size, args->flags); } static int
fs/ext4/xattr_trusted.c +6 -9
@@ -21,21 +21,18 @@ ext4_xattr_trusted_list(struct dentry *dentry)static int ext4_xattr_trusted_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return ext4_xattr_get (inode,EXT4_XATTR_INDEX_TRUSTED , - name, buffer, size); +return ext4_xattr_get (args->inode,EXT4_XATTR_INDEX_TRUSTED , + args->name, args->buffer, args->size); }static int ext4_xattr_trusted_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -return ext4_xattr_set (inode,EXT4_XATTR_INDEX_TRUSTED , - name, value, size, flags); +return ext4_xattr_set (args->inode,EXT4_XATTR_INDEX_TRUSTED , + args->name, args->value, args->size, args->flags); }const struct xattr_handler ext4_xattr_trusted_handler = {
fs/ext4/xattr_user.c +8 -11
@@ -20,25 +20,22 @@ ext4_xattr_user_list(struct dentry *dentry)static int ext4_xattr_user_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -if (!test_opt (inode->i_sb,XATTR_USER )) +if (!test_opt (args->inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext4_xattr_get (inode,EXT4_XATTR_INDEX_USER , - name, buffer, size); +return ext4_xattr_get (args->inode,EXT4_XATTR_INDEX_USER , + args->name, args->buffer, args->size); }static int ext4_xattr_user_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -if (!test_opt (inode->i_sb,XATTR_USER )) +if (!test_opt (args->inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext4_xattr_set (inode,EXT4_XATTR_INDEX_USER , - name, value, size, flags); +return ext4_xattr_set (args->inode,EXT4_XATTR_INDEX_USER , + args->name, args->value, args->size, args->flags); }const struct xattr_handler ext4_xattr_user_handler = {
fs/f2fs/xattr.c +18 -24
88 lines not on this page · raw message
fs/fuse/xattr.c +9 -14
@@ -175,21 +175,19 @@ int fuse_removexattr(struct inode *inode, const char *name) }static int fuse_xattr_get (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,void *value,size_t size) +struct xattr_gs_args *args) { -return fuse_getxattr (inode, name, value, size); +return fuse_getxattr (args->inode, args->name, args->buffer, args->size); }static int fuse_xattr_set (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,const void *value,size_t size, -int flags) +struct xattr_gs_args *args) { -if (!value) -return fuse_removexattr (inode, name); +if (!args->value) +return fuse_removexattr (args->inode, args->name); -return fuse_setxattr (inode, name, value, size, flags); +return fuse_setxattr (args->inode, args->name, + args->value, args->size, args->flags); }static bool no_xattr_list (struct dentry *dentry)
@@ -198,16 +196,13 @@ static bool no_xattr_list(struct dentry *dentry) }static int no_xattr_get (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,void *value,size_t size) +struct xattr_gs_args *args) {return -EOPNOTSUPP ; }static int no_xattr_set (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *nodee, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) {return -EOPNOTSUPP ; }
fs/gfs2/xattr.c +9 -9
@@ -587,10 +587,9 @@ static int __gfs2_xattr_get(struct inode *inode, const char *name, }static int gfs2_xattr_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -struct gfs2_inode *ip =GFS2_I (inode); +struct gfs2_inode *ip =GFS2_I (args->inode);struct gfs2_holder gh;int ret;
@@ -603,7 +602,8 @@ static int gfs2_xattr_get(const struct xattr_handler *handler, }else {gfs2_holder_mark_uninitialized (&gh); } - ret =__gfs2_xattr_get (inode, name, buffer, size, handler->flags); + ret =__gfs2_xattr_get (args->inode, args->name, + args->buffer, args->size, handler->flags);if (gfs2_holder_initialized (&gh))gfs2_glock_dq_uninit (&gh);return ret;
@@ -1214,11 +1214,9 @@ int __gfs2_xattr_set(struct inode *inode, const char *name, }static int gfs2_xattr_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -struct gfs2_inode *ip =GFS2_I (inode); +struct gfs2_inode *ip =GFS2_I (args->inode);struct gfs2_holder gh;int ret;
@@ -1237,7 +1235,9 @@ static int gfs2_xattr_set(const struct xattr_handler *handler,return -EIO ;gfs2_holder_mark_uninitialized (&gh); } - ret =__gfs2_xattr_set (inode, name, value, size, flags, handler->flags); + ret =__gfs2_xattr_set (args->inode, args->name, + args->value, args->size, + args->flags, handler->flags);if (gfs2_holder_initialized (&gh))gfs2_glock_dq_uninit (&gh);return ret;
fs/hfs/attr.c +7 -8
@@ -114,21 +114,20 @@ static ssize_t __hfs_getxattr(struct inode *inode, enum hfs_xattr_type type, }static int hfs_xattr_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *value,size_t size) +struct xattr_gs_args *args) { -return __hfs_getxattr (inode, handler->flags, value, size); +return __hfs_getxattr (args->inode, handler->flags, + args->buffer, args->size); }static int hfs_xattr_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value,size_t size, -int flags) +struct xattr_gs_args *args) { -if (!value) +if (!args->value)return -EOPNOTSUPP ; -return __hfs_setxattr (inode, handler->flags, value, size, flags); +return __hfs_setxattr (args->inode, handler->flags, + args->value, args->size, args->flags); }static const struct xattr_handler hfs_creator_handler = {
fs/hfsplus/xattr.c +8 -9
@@ -838,14 +838,13 @@ static int hfsplus_removexattr(struct inode *inode, const char *name) }static int hfsplus_osx_getxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) {/* * Don't allow retrieving properly prefixed attributes * by prepending them with "osx." */ -if (is_known_namespace (name)) +if (is_known_namespace (args->name))return -EOPNOTSUPP ;/*
@@ -854,19 +853,18 @@ static int hfsplus_osx_getxattr(const struct xattr_handler *handler,* creates), so we pass the name through unmodified (after * ensuring it doesn't conflict with another namespace). */ -return __hfsplus_getxattr (inode, name, buffer, size); +return __hfsplus_getxattr (args->inode, args->name, + args->buffer, args->size); }static int hfsplus_osx_setxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *buffer, -size_t size,int flags) +struct xattr_gs_args *args) {/* * Don't allow setting properly prefixed attributes * by prepending them with "osx." */ -if (is_known_namespace (name)) +if (is_known_namespace (args->name))return -EOPNOTSUPP ;/*
@@ -875,7 +873,8 @@ static int hfsplus_osx_setxattr(const struct xattr_handler *handler,* creates), so we pass the name through unmodified (after * ensuring it doesn't conflict with another namespace). */ -return __hfsplus_setxattr (inode, name, buffer, size, flags); +return __hfsplus_setxattr (args->inode, args->name, + args->value, args->size, args->flags); }const struct xattr_handler hfsplus_xattr_osx_handler = {
fs/hfsplus/xattr_security.c +6 -7
@@ -14,20 +14,19 @@#include "xattr.h" static int hfsplus_security_getxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return hfsplus_getxattr (inode, name, buffer, size, +return hfsplus_getxattr (args->inode, args->name, + args->buffer, args->size,XATTR_SECURITY_PREFIX ,XATTR_SECURITY_PREFIX_LEN ); }static int hfsplus_security_setxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *buffer, -size_t size,int flags) +struct xattr_gs_args *args) { -return hfsplus_setxattr (inode, name, buffer, size, flags, +return hfsplus_setxattr (args->inode, args->name, + args->value, args->size, args->flags,XATTR_SECURITY_PREFIX ,XATTR_SECURITY_PREFIX_LEN ); }
fs/hfsplus/xattr_trusted.c +6 -7
@@ -13,20 +13,19 @@#include "xattr.h" static int hfsplus_trusted_getxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return hfsplus_getxattr (inode, name, buffer, size, +return hfsplus_getxattr (args->inode, args->name, + args->buffer, args->size,XATTR_TRUSTED_PREFIX ,XATTR_TRUSTED_PREFIX_LEN ); }static int hfsplus_trusted_setxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *buffer, -size_t size,int flags) +struct xattr_gs_args *args) { -return hfsplus_setxattr (inode, name, buffer, size, flags, +return hfsplus_setxattr (args->inode, args->name, + args->buffer, args->size, args->flags,XATTR_TRUSTED_PREFIX ,XATTR_TRUSTED_PREFIX_LEN ); }
fs/hfsplus/xattr_user.c +6 -7
@@ -13,20 +13,19 @@#include "xattr.h" static int hfsplus_user_getxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return hfsplus_getxattr (inode, name, buffer, size, +return hfsplus_getxattr (args->inode, args->name, + args->buffer, args->size,XATTR_USER_PREFIX ,XATTR_USER_PREFIX_LEN ); }static int hfsplus_user_setxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *buffer, -size_t size,int flags) +struct xattr_gs_args *args) { -return hfsplus_setxattr (inode, name, buffer, size, flags, +return hfsplus_setxattr (args->inode, args->name, + args->value, args->size, args->flags,XATTR_USER_PREFIX ,XATTR_USER_PREFIX_LEN ); }
fs/jffs2/security.c +7 -9
@@ -49,20 +49,18 @@ int jffs2_init_security(struct inode *inode, struct inode *dir,/* ---- XATTR Handler for "security.*" ----------------- */ static int jffs2_security_getxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return do_jffs2_getxattr (inode,JFFS2_XPREFIX_SECURITY , - name, buffer, size); +return do_jffs2_getxattr (args->inode,JFFS2_XPREFIX_SECURITY , + args->name, args->buffer, args->size); }static int jffs2_security_setxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *buffer, -size_t size,int flags) +struct xattr_gs_args *args) { -return do_jffs2_setxattr (inode,JFFS2_XPREFIX_SECURITY , - name, buffer, size, flags); +return do_jffs2_setxattr (args->inode,JFFS2_XPREFIX_SECURITY , + args->name, args->value, args->size, + args->flags); }const struct xattr_handler jffs2_security_xattr_handler = {
fs/jffs2/xattr_trusted.c +7 -9
@@ -17,20 +17,18 @@#include "nodelist.h" static int jffs2_trusted_getxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return do_jffs2_getxattr (inode,JFFS2_XPREFIX_TRUSTED , - name, buffer, size); +return do_jffs2_getxattr (args->inode,JFFS2_XPREFIX_TRUSTED , + args->name, args->buffer, args->size); }static int jffs2_trusted_setxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *buffer, -size_t size,int flags) +struct xattr_gs_args *args) { -return do_jffs2_setxattr (inode,JFFS2_XPREFIX_TRUSTED , - name, buffer, size, flags); +return do_jffs2_setxattr (args->inode,JFFS2_XPREFIX_TRUSTED , + args->name, args->value, args->size, + args->flags); }static bool jffs2_trusted_listxattr (struct dentry *dentry)
fs/jffs2/xattr_user.c +7 -9
@@ -17,20 +17,18 @@#include "nodelist.h" static int jffs2_user_getxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -return do_jffs2_getxattr (inode,JFFS2_XPREFIX_USER , - name, buffer, size); +return do_jffs2_getxattr (args->inode,JFFS2_XPREFIX_USER , + args->name, args->buffer, args->size); }static int jffs2_user_setxattr (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *buffer, -size_t size,int flags) +struct xattr_gs_args *args) { -return do_jffs2_setxattr (inode,JFFS2_XPREFIX_USER , - name, buffer, size, flags); +return do_jffs2_setxattr (args->inode,JFFS2_XPREFIX_USER , + args->name, args->value, args->size, + args->flags); }const struct xattr_handler jffs2_user_xattr_handler = {
fs/jfs/xattr.c +15 -18
@@ -924,39 +924,36 @@ static int __jfs_xattr_set(struct inode *inode, const char *name, }static int jfs_xattr_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *value,size_t size) +struct xattr_gs_args *args) { - name =xattr_full_name (handler, name); -return __jfs_getxattr (inode, name, value, size); +return __jfs_getxattr (args->inode,xattr_full_name (handler, args->name), + args->buffer, args->size); }static int jfs_xattr_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { - name =xattr_full_name (handler, name); -return __jfs_xattr_set (inode, name, value, size, flags); +return __jfs_xattr_set (args->inode, +xattr_full_name (handler, args->name), + args->value, args->size, args->flags); }static int jfs_xattr_get_os2 (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *value,size_t size) +struct xattr_gs_args *args) { -if (is_known_namespace (name)) +if (is_known_namespace (args->name))return -EOPNOTSUPP ; -return __jfs_getxattr (inode, name, value, size); +return __jfs_getxattr (args->inode, args->name, + args->buffer, args->size); }static int jfs_xattr_set_os2 (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -if (is_known_namespace (name)) +if (is_known_namespace (args->name))return -EOPNOTSUPP ; -return __jfs_xattr_set (inode, name, value, size, flags); +return __jfs_xattr_set (args->inode, args->name, + args->value, args->size, args->flags); }static const struct xattr_handler jfs_user_xattr_handler = {
fs/kernfs/inode.c +9 -12
@@ -288,13 +288,13 @@ int kernfs_iop_permission(struct inode *inode, int mask) }int kernfs_xattr_get (struct kernfs_node *kn,const char *name, -void *value,size_t size) +void *buffer,size_t size) {struct kernfs_iattrs *attrs =kernfs_iattrs_noalloc (kn);if (!attrs)return -ENODATA ; -return simple_xattr_get (&attrs->xattrs, name, value, size); +return simple_xattr_get (&attrs->xattrs, name, buffer, size); } int kernfs_xattr_set(struct kernfs_node *kn, const char *name,
@@ -308,24 +308,21 @@ int kernfs_xattr_set(struct kernfs_node *kn, const char *name, }static int kernfs_vfs_xattr_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *suffix,void *value,size_t size) +struct xattr_gs_args *args) { -const char *name =xattr_full_name (handler, suffix); -struct kernfs_node *kn = inode->i_private; +struct kernfs_node *kn = args->inode->i_private; -return kernfs_xattr_get (kn, name, value, size); +return kernfs_xattr_get (kn,xattr_full_name (handler, args->name), + args->buffer, args->size); }static int kernfs_vfs_xattr_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *suffix,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -const char *name =xattr_full_name (handler, suffix);struct kernfs_node *kn = inode->i_private; -return kernfs_xattr_set (kn, name, value, size, flags); +return kernfs_xattr_set (kn,xattr_full_name (handler, args->name), + args->value, args->size, args->flags); }static const struct xattr_handler kernfs_trusted_xattr_handler = {
fs/nfs/nfs4proc.c +12 -16
@@ -7209,18 +7209,15 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)#define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"static int nfs4_xattr_set_nfs4_acl (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *key,const void *buf, -size_t buflen,int flags) +struct xattr_gs_args *args) { -return nfs4_proc_set_acl (inode, buf, buflen); +return nfs4_proc_set_acl (args->inode, args->value, args->size); }static int nfs4_xattr_get_nfs4_acl (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *key,void *buf,size_t buflen) +struct xattr_gs_args *args) { -return nfs4_proc_get_acl (inode, buf, buflen); +return nfs4_proc_get_acl (args->inode, args->buffer, args->size); }static bool nfs4_xattr_list_nfs4_acl (struct dentry *dentry)
@@ -7231,22 +7228,21 @@ static bool nfs4_xattr_list_nfs4_acl(struct dentry *dentry)#ifdef CONFIG_NFS_V4_SECURITY_LABEL static int nfs4_xattr_set_nfs4_label (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *key,const void *buf, -size_t buflen,int flags) +struct xattr_gs_args *args) { -if (security_ismaclabel (key)) -return nfs4_set_security_label (inode, buf, buflen); +if (security_ismaclabel (args->name)) +return nfs4_set_security_label (args->inode, + args->value, args->size);return -EOPNOTSUPP ; }static int nfs4_xattr_get_nfs4_label (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *key,void *buf,size_t buflen) +struct xattr_gs_args *args) { -if (security_ismaclabel (key)) -return nfs4_get_security_label (inode, buf, buflen); +if (security_ismaclabel (args->name)) +return nfs4_get_security_label (args->inode, + args->buffer, args->size);return -EOPNOTSUPP ; }
fs/ocfs2/xattr.c +23 -29
92 lines not on this page · raw message
fs/orangefs/xattr.c +6 -13
@@ -526,24 +526,17 @@ ssize_t orangefs_listxattr(struct dentry *dentry, char *buffer, size_t size) }static int orangefs_xattr_set_default (const struct xattr_handler *handler, -struct dentry *unused, -struct inode *inode, -const char *name, -const void *buffer, -size_t size, -int flags) +struct xattr_gs_args *args) { -return orangefs_inode_setxattr (inode, name, buffer, size, flags); +return orangefs_inode_setxattr (args->inode, args->name, + args->value, args->size, args->flags); }static int orangefs_xattr_get_default (const struct xattr_handler *handler, -struct dentry *unused, -struct inode *inode, -const char *name, -void *buffer, -size_t size) +struct xattr_gs_args *args) { -return orangefs_inode_getxattr (inode, name, buffer, size); +return orangefs_inode_getxattr (args->inode, args->name, + args->buffer, args->size); }
fs/overlayfs/inode.c +22 -21
82 lines not on this page · raw message
fs/overlayfs/overlayfs.h +2 -4
@@ -353,10 +353,8 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr);int ovl_getattr (const struct path *path,struct kstat *stat,u32 request_mask,unsigned int flags);int ovl_permission (struct inode *inode,int mask); -int ovl_xattr_set (struct dentry *dentry,struct inode *inode,const char *name, -const void *value,size_t size,int flags); -int ovl_xattr_get (struct dentry *dentry,struct inode *inode,const char *name, -void *value,size_t size); +int ovl_xattr_set (struct xattr_gs_args *args); +int ovl_xattr_get (struct xattr_gs_args *args);ssize_t ovl_listxattr (struct dentry *dentry,char *list,size_t size);struct posix_acl *ovl_get_acl (struct inode *inode,int type);int ovl_update_time (struct inode *inode,struct timespec64 *ts,int flags);
fs/overlayfs/super.c +23 -30
114 lines not on this page · raw message
fs/posix_acl.c +11 -12
@@ -831,24 +831,24 @@ EXPORT_SYMBOL (posix_acl_to_xattr);static int posix_acl_xattr_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *value,size_t size) +struct xattr_gs_args *args) {struct posix_acl *acl;int error; -if (!IS_POSIXACL (inode)) +if (!IS_POSIXACL (args->inode))return -EOPNOTSUPP ; -if (S_ISLNK (inode->i_mode)) +if (S_ISLNK (args->inode->i_mode))return -EOPNOTSUPP ; - acl =get_acl (inode, handler->flags); + acl =get_acl (args->inode, handler->flags);if (IS_ERR (acl))return PTR_ERR (acl);if (acl ==NULL )return -ENODATA ; - error =posix_acl_to_xattr (&init_user_ns, acl, value, size); + error =posix_acl_to_xattr (&init_user_ns, acl, + args->buffer, args->size);posix_acl_release (acl);return error;
@@ -878,19 +878,18 @@ EXPORT_SYMBOL(set_posix_acl);static int posix_acl_xattr_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) {struct posix_acl *acl =NULL ;int ret; -if (value) { - acl =posix_acl_from_xattr (&init_user_ns, value, size); +if (args->value) { + acl =posix_acl_from_xattr (&init_user_ns, + args->value, args->size);if (IS_ERR (acl))return PTR_ERR (acl); } - ret =set_posix_acl (inode, handler->flags, acl); + ret =set_posix_acl (args->inode, handler->flags, acl);posix_acl_release (acl);return ret; }
fs/reiserfs/xattr.c +1 -1
@@ -765,7 +765,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer,/* This is the implementation for the xattr plugin infrastructure */ static inline const struct xattr_handler *find_xattr_handler_prefix (const struct xattr_handler **handlers, -const char *name) +const char *name) {const struct xattr_handler *xah;
fs/reiserfs/xattr_security.c +10 -12
@@ -10,27 +10,25 @@#include <linux/uaccess.h> static int -security_get (const struct xattr_handler *handler,struct dentry *unused, -struct inode *inode,const char *name,void *buffer,size_t size) +security_get (const struct xattr_handler *handler,struct xattr_gs_args *args) { -if (IS_PRIVATE (inode)) +if (IS_PRIVATE (args->inode))return -EPERM ; -return reiserfs_xattr_get (inode,xattr_full_name (handler, name), - buffer, size); +return reiserfs_xattr_get (args->inode, +xattr_full_name (handler, args->name), + args->buffer, args->size); }static int -security_set (const struct xattr_handler *handler,struct dentry *unused, -struct inode *inode,const char *name,const void *buffer, -size_t size,int flags) +security_set (const struct xattr_handler *handler,struct xattr_gs_args *args) { -if (IS_PRIVATE (inode)) +if (IS_PRIVATE (args->inode))return -EPERM ; -return reiserfs_xattr_set (inode, -xattr_full_name (handler, name), - buffer, size, flags); +return reiserfs_xattr_set (args->inode, +xattr_full_name (handler, args->name), + args->value, args->size, args->flags); }static bool security_list (struct dentry *dentry)
fs/reiserfs/xattr_trusted.c +10 -12
@@ -9,27 +9,25 @@#include <linux/uaccess.h> static int -trusted_get (const struct xattr_handler *handler,struct dentry *unused, -struct inode *inode,const char *name,void *buffer,size_t size) +trusted_get (const struct xattr_handler *handler,struct xattr_gs_args *args) { -if (!capable (CAP_SYS_ADMIN ) ||IS_PRIVATE (inode)) +if (!capable (CAP_SYS_ADMIN ) ||IS_PRIVATE (args->inode))return -EPERM ; -return reiserfs_xattr_get (inode,xattr_full_name (handler, name), - buffer, size); +return reiserfs_xattr_get (args->inode, +xattr_full_name (handler, args->name), + args->buffer, args->size); }static int -trusted_set (const struct xattr_handler *handler,struct dentry *unused, -struct inode *inode,const char *name,const void *buffer, -size_t size,int flags) +trusted_set (const struct xattr_handler *handler,struct xattr_gs_args *args) { -if (!capable (CAP_SYS_ADMIN ) ||IS_PRIVATE (inode)) +if (!capable (CAP_SYS_ADMIN ) ||IS_PRIVATE (args->inode))return -EPERM ; -return reiserfs_xattr_set (inode, -xattr_full_name (handler, name), - buffer, size, flags); +return reiserfs_xattr_set (args->inode, +xattr_full_name (handler, args->name), + args->value, args->size, args->flags); }static bool trusted_list (struct dentry *dentry)
fs/reiserfs/xattr_user.c +10 -12
@@ -8,25 +8,23 @@#include <linux/uaccess.h> static int -user_get (const struct xattr_handler *handler,struct dentry *unused, -struct inode *inode,const char *name,void *buffer,size_t size) +user_get (const struct xattr_handler *handler,struct xattr_gs_args *args) { -if (!reiserfs_xattrs_user (inode->i_sb)) +if (!reiserfs_xattrs_user (args->inode->i_sb))return -EOPNOTSUPP ; -return reiserfs_xattr_get (inode,xattr_full_name (handler, name), - buffer, size); +return reiserfs_xattr_get (args->inode, +xattr_full_name (handler, args->name), + args->buffer, args->size); }static int -user_set (const struct xattr_handler *handler,struct dentry *unused, -struct inode *inode,const char *name,const void *buffer, -size_t size,int flags) +user_set (const struct xattr_handler *handler,struct xattr_gs_args *args) { -if (!reiserfs_xattrs_user (inode->i_sb)) +if (!reiserfs_xattrs_user (args->inode->i_sb))return -EOPNOTSUPP ; -return reiserfs_xattr_set (inode, -xattr_full_name (handler, name), - buffer, size, flags); +return reiserfs_xattr_set (args->inode, +xattr_full_name (handler, args->name), + args->value, args->size, args->flags); }static bool user_list (struct dentry *dentry)
fs/squashfs/xattr.c +3 -7
@@ -199,15 +199,11 @@ static int squashfs_xattr_get(struct inode *inode, int name_index,return err; } -static int squashfs_xattr_handler_get (const struct xattr_handler *handler, -struct dentry *unused, -struct inode *inode, -const char *name, -void *buffer,size_t size) +struct xattr_gs_args *args) { -return squashfs_xattr_get (inode, handler->flags, name, - buffer, size); +return squashfs_xattr_get (args->inode, handler->flags, args->name, + args->buffer, args->size); }/*
fs/ubifs/xattr.c +13 -14
@@ -668,30 +668,29 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode,#endif static int xattr_get (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -dbg_gen ("xattr '%s', ino %lu ('%pd'), buf size %zd" , name, - inode->i_ino, dentry, size); +dbg_gen ("xattr '%s', ino %lu ('%pd'), buf size %zd" , args->name, + args->inode->i_ino, args->dentry, args->size); - name =xattr_full_name (handler, name); -return ubifs_xattr_get (inode, name, buffer, size); +return ubifs_xattr_get (args->inode,xattr_full_name (handler, name), + args->buffer, args->size); }static int xattr_set (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) {dbg_gen ("xattr '%s', host ino %lu ('%pd'), size %zd" , - name, inode->i_ino, dentry, size); - - name =xattr_full_name (handler, name); + args->name, args->inode->i_ino, args->dentry, args->size);if (value) -return ubifs_xattr_set (inode, name, value, size, flags, true); +return ubifs_xattr_set (args->inode, +xattr_full_name (handler, args->name), + args->value, args->size, + args->flags, true);else -return ubifs_xattr_remove (inode, name); +return ubifs_xattr_remove (args->inode, +xattr_full_name (handler, args->name)); }static const struct xattr_handler ubifs_user_xattr_handler = {
fs/xattr.c +69 -43
185 lines not on this page · raw message
fs/xfs/libxfs/xfs_attr.c +1 -1
@@ -305,7 +305,7 @@ intxfs_attr_set ( struct xfs_inode *dp, const unsigned char *name, - unsigned char *value, + const unsigned char *value, int valuelen, int flags) {
fs/xfs/libxfs/xfs_attr.h +1 -1
@@ -145,7 +145,7 @@ int xfs_attr_get_ilocked(struct xfs_inode *ip, struct xfs_da_args *args);int xfs_attr_get (struct xfs_inode *ip,const unsigned char *name,unsigned char *value,int *valuelenp,int flags);int xfs_attr_set (struct xfs_inode *dp,const unsigned char *name, -unsigned char *value,int valuelen,int flags); +const unsigned char *value,int valuelen,int flags);int xfs_attr_set_args (struct xfs_da_args *args);int xfs_attr_remove (struct xfs_inode *dp,const unsigned char *name,int flags);int xfs_attr_remove_args (struct xfs_da_args *args);
fs/xfs/xfs_xattr.c +17 -18
@@ -17,20 +17,20 @@static int -xfs_xattr_get (const struct xattr_handler *handler,struct dentry *unused, -struct inode *inode,const char *name,void *value,size_t size) +xfs_xattr_get (const struct xattr_handler *handler,struct xattr_gs_args *args) {int xflags = handler->flags; -struct xfs_inode *ip =XFS_I (inode); -int error, asize = size; +struct xfs_inode *ip =XFS_I (args->inode); +int error, asize = args->size;/* Convert Linux syscall to XFS internal ATTR flags */ -if (!size) { +if (!args->size) { xflags |=ATTR_KERNOVAL ; - value =NULL ; + args->buffer =NULL ; } - error =xfs_attr_get (ip, (unsigned char *)name, value, &asize, xflags); + error =xfs_attr_get (ip, (const unsigned char *)args->name, + args->buffer, &asize, xflags);if (error)return error;return asize;
@@ -59,26 +59,25 @@ xfs_forget_acl( }static int -xfs_xattr_set (const struct xattr_handler *handler,struct dentry *unused, -struct inode *inode,const char *name,const void *value, -size_t size,int flags) +xfs_xattr_set (const struct xattr_handler *handler,struct xattr_gs_args *args) {int xflags = handler->flags; -struct xfs_inode *ip =XFS_I (inode); +struct xfs_inode *ip =XFS_I (args->inode);int error;/* Convert Linux syscall to XFS internal ATTR flags */ -if (flags &XATTR_CREATE ) +if (args->flags &XATTR_CREATE ) xflags |=ATTR_CREATE ; -if (flags &XATTR_REPLACE ) +if (args->flags &XATTR_REPLACE ) xflags |=ATTR_REPLACE ; -if (!value) -return xfs_attr_remove (ip, (unsigned char *)name, xflags); - error =xfs_attr_set (ip, (unsigned char *)name, - (void *)value, size, xflags); +if (!args->value) +return xfs_attr_remove (ip, (const unsigned char *)args->name, + xflags); + error =xfs_attr_set (ip, (const unsigned char *)args->name, + args->value, args->size, xflags);if (!error) -xfs_forget_acl (inode, name, xflags); +xfs_forget_acl (args->inode, args->name, xflags);return error; }
include/linux/xattr.h +18 -8
@@ -25,17 +25,27 @@ struct dentry;* name. When @prefix is set instead, match attributes with that prefix and * with a non-empty suffix. */ +struct xattr_gs_args { +struct dentry *dentry; +struct inode *inode; +const char *name; +union { +void *buffer; +const void *value; + }; +size_t size; +int flags; +}; +struct xattr_handler {const char *name;const char *prefix;int flags;/* fs private flags */ bool (*list)(struct dentry *dentry); -int (*get)(const struct xattr_handler *,struct dentry *dentry, -struct inode *inode,const char *name,void *buffer, -size_t size); -int (*set)(const struct xattr_handler *,struct dentry *dentry, -struct inode *inode,const char *name,const void *buffer, -size_t size,int flags); +int (*get)(const struct xattr_handler *handler, +struct xattr_gs_args *args); +int (*set)(const struct xattr_handler *handler, +struct xattr_gs_args *args); };const char *xattr_full_name (const struct xattr_handler *,const char *);
@@ -46,10 +56,10 @@ struct xattr {size_t value_len; }; -ssize_t __vfs_getxattr (struct dentry *,struct inode *,const char *,void *,size_t ); +ssize_t __vfs_getxattr (struct xattr_gs_args *args);ssize_t vfs_getxattr (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 (struct xattr_gs_args *args);int __vfs_setxattr_noperm (struct dentry *,const char *,const void *,size_t ,int );int vfs_setxattr (struct dentry *,const char *,const void *,size_t ,int );int __vfs_removexattr (struct dentry *,const char *);
include/uapi/linux/xattr.h +5 -2
@@ -17,8 +17,11 @@#if __UAPI_DEF_XATTR#define __USE_KERNEL_XATTR_DEFS -#define XATTR_CREATE 0x1/* set value, fail if attr already exists */ -#define XATTR_REPLACE 0x2/* set value, fail if attr does not exist */ +#define XATTR_CREATE 0x1/* set value, fail if attr already exists */ +#define XATTR_REPLACE 0x2/* set value, fail if attr does not exist */ +#ifdef __KERNEL__/* following is kernel internal, colocated for maintenance */ +#define XATTR_NOSECURITY 0x4/* get value, do not involve security check */ +#endif #endif /* Namespaces */
mm/shmem.c +10 -11
@@ -3205,24 +3205,23 @@ static int shmem_initxattrs(struct inode *inode, }static int shmem_xattr_handler_get (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,void *buffer,size_t size) +struct xattr_gs_args *args) { -struct shmem_inode_info *info =SHMEM_I (inode); +struct shmem_inode_info *info =SHMEM_I (args->inode); - name =xattr_full_name (handler, name); -return simple_xattr_get (&info->xattrs, name, buffer, size); +return simple_xattr_get (&info->xattrs, +xattr_full_name (handler, args->name), + args->buffer, args->size); }static int shmem_xattr_handler_set (const struct xattr_handler *handler, -struct dentry *unused,struct inode *inode, -const char *name,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) { -struct shmem_inode_info *info =SHMEM_I (inode); +struct shmem_inode_info *info =SHMEM_I (args->inode); - name =xattr_full_name (handler, name); -return simple_xattr_set (&info->xattrs, name, value, size, flags); +return simple_xattr_set (&info->xattrs, +xattr_full_name (handler, args->name), + args->value, args->size, args->flags); }static const struct xattr_handler shmem_security_xattr_handler = {
net/socket.c +7 -9
@@ -299,15 +299,15 @@ static const struct dentry_operations sockfs_dentry_operations = { };static int sockfs_xattr_get (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *suffix,void *value,size_t size) +struct xattr_gs_args *args) { -if (value) { -if (dentry->d_name.len +1 > size) +if (args->buffer) { +if (args->dentry->d_name.len +1 > args->size)return -ERANGE ; -memcpy (value, dentry->d_name.name, dentry->d_name.len +1 ); +memcpy (args->buffer, args->dentry->d_name.name, + args->dentry->d_name.len +1 ); } -return dentry->d_name.len +1 ; +return args->dentry->d_name.len +1 ; }#define XATTR_SOCKPROTONAME_SUFFIX "sockprotoname"
@@ -320,9 +320,7 @@ static const struct xattr_handler sockfs_xattr_handler = { };static int sockfs_security_xattr_set (const struct xattr_handler *handler, -struct dentry *dentry,struct inode *inode, -const char *suffix,const void *value, -size_t size,int flags) +struct xattr_gs_args *args) {/* Handled by LSM. */ return -EAGAIN ;
security/commoncap.c +20 -9
@@ -294,11 +294,15 @@ int cap_capset(struct cred *new,*/ int cap_inode_need_killpriv (struct dentry *dentry) { -struct inode *inode =d_backing_inode (dentry); -int error; +struct xattr_gs_args args; + +memset (&args,0 ,sizeof (args)); + args.dentry = dentry; + args.inode =d_backing_inode (dentry); + args.name =XATTR_NAME_CAPS ; + args.flags =XATTR_NOSECURITY ; - error =__vfs_getxattr (dentry, inode,XATTR_NAME_CAPS ,NULL ,0 ); -return error >0 ; +return __vfs_getxattr (&args) >0 ; }/**
@@ -570,7 +574,7 @@ static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps,*/ int get_vfs_caps_from_disk (const struct dentry *dentry,struct cpu_vfs_cap_data *cpu_caps) { -struct inode *inode =d_backing_inode (dentry); +struct xattr_gs_args args;__u32 magic_etc;unsigned tocopy, i;int size;
@@ -580,13 +584,20 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_datastruct user_namespace *fs_ns;memset (cpu_caps,0 ,sizeof (struct cpu_vfs_cap_data )); +memset (&args,0 ,sizeof (args)); -if (!inode) + args.dentry = (struct dentry *)dentry; + args.inode =d_backing_inode (args.dentry); +if (!args.inode)return -ENODATA ; - fs_ns = inode->i_sb->s_user_ns; - size =__vfs_getxattr ((struct dentry *)dentry, inode, -XATTR_NAME_CAPS , &data,XATTR_CAPS_SZ ); + fs_ns = args.inode->i_sb->s_user_ns; + + args.name =XATTR_NAME_CAPS ; + args.buffer = &data; + args.size =XATTR_CAPS_SZ ; + args.flags =XATTR_NOSECURITY ; + size =__vfs_getxattr (&args);if (size == -ENODATA || size == -EOPNOTSUPP )/* no data, that's ok */ return -ENODATA ;
security/integrity/evm/evm_main.c +9 -2
@@ -91,16 +91,23 @@ static bool evm_key_loaded(void)static int evm_find_protected_xattrs (struct dentry *dentry) { -struct inode *inode =d_backing_inode (dentry); +struct xattr_gs_args args;struct xattr_list *xattr;int error;int count =0 ; +memset (&args,0 ,sizeof (args)); + args.dentry = dentry; + args.inode =d_backing_inode (dentry); +if (!(inode->i_opflags &IOP_XATTR ))return -EOPNOTSUPP ; + args.flags =XATTR_NOSECURITY ; +list_for_each_entry_rcu (xattr, &evm_config_xattrnames, list) { - error =__vfs_getxattr (dentry, inode, xattr->name,NULL ,0 ); + args.flags = xattr->name; + error =__vfs_getxattr (&args);if (error <0 ) {if (error == -ENODATA )continue ;
security/selinux/hooks.c +23 -5
@@ -540,6 +540,8 @@ static int sb_finish_set_opts(struct super_block *sb)int rc =0 ;if (sbsec->behavior ==SECURITY_FS_USE_XATTR ) { +struct xattr_gs_args args; +/* Make sure that the xattr handler exists and that no error other than -ENODATA is returned by getxattr on the root directory. -ENODATA is ok, as this may be
@@ -552,7 +554,12 @@ static int sb_finish_set_opts(struct super_block *sb) goto out; } - rc =__vfs_getxattr (root, root_inode,XATTR_NAME_SELINUX ,NULL ,0 ); +memset (&args,0 ,sizeof (args)); + args.dentry = root; + args.inode = root_inode; + args.name =XATTR_NAME_SELINUX ; + args.flags =XATTR_NOSECURITY ; + rc =__vfs_getxattr (&args);if (rc <0 && rc != -ENODATA ) {if (rc == -EOPNOTSUPP ) pr_warn("SELinux: (dev %s, type "
@@ -1371,6 +1378,7 @@ static int inode_doinit_use_xattr(struct inode *inode, struct dentry *dentry,char *context;unsigned int len;int rc; +struct xattr_gs_args args; len =INITCONTEXTLEN ; context =kmalloc (len +1 ,GFP_NOFS );
@@ -1378,12 +1386,21 @@ static int inode_doinit_use_xattr(struct inode *inode, struct dentry *dentry,return -ENOMEM ; context[len] ='\0' ; - rc =__vfs_getxattr (dentry, inode,XATTR_NAME_SELINUX , context, len); +memset (&args,0 ,sizeof (args)); + args.dentry = dentry; + args.inode = inode; + args.name =XATTR_NAME_SELINUX ; + args.buffer = context; + args.size = len; + args.flags =XATTR_NOSECURITY ; + rc =__vfs_getxattr (&args);if (rc == -ERANGE ) {kfree (context);/* Need a larger buffer. Query for the right size. */ - rc =__vfs_getxattr (dentry, inode,XATTR_NAME_SELINUX ,NULL ,0 ); + args.buffer =NULL ; + args.size =0 ; + rc =__vfs_getxattr (&args);if (rc <0 )return rc;
@@ -1393,8 +1410,9 @@ static int inode_doinit_use_xattr(struct inode *inode, struct dentry *dentry,return -ENOMEM ; context[len] ='\0' ; - rc =__vfs_getxattr (dentry, inode,XATTR_NAME_SELINUX , - context, len); + args.buffer = context; + args.size = len; + rc =__vfs_getxattr (&args); }if (rc <0 ) {kfree (context);
security/smack/smack_lsm.c +23 -11
@@ -282,17 +282,24 @@ static struct smack_known *smk_fetch(const char *name, struct inode *ip, struct dentry *dp) {int rc; -char *buffer;struct smack_known *skp =NULL ; +struct xattr_gs_args args;if (!(ip->i_opflags &IOP_XATTR ))return ERR_PTR (-EOPNOTSUPP ); - buffer =kzalloc (SMK_LONGLABEL ,GFP_KERNEL ); -if (buffer ==NULL ) +memset (&args,0 ,sizeof (args)); + args.dentry = dp; + args.inode = ip; + args.name = name; + args.buffer =kzalloc (SMK_LONGLABEL ,GFP_KERNEL ); + args.size =SMK_LONGLABEL ; + args.flags =XATTR_NOSECURITY ; + +if (args.buffer ==NULL )return ERR_PTR (-ENOMEM ); - rc =__vfs_getxattr (dp, ip, name, buffer,SMK_LONGLABEL ); + rc =__vfs_getxattr (&args);if (rc <0 ) skp =ERR_PTR (rc);else if (rc ==0 )
@@ -3424,6 +3431,8 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)* Transmuting directory */ if (S_ISDIR (inode->i_mode)) { +struct xattr_gs_args args; +/* * If this is a new directory and the label was * transmuted when the inode was initialized
@@ -3433,16 +3442,19 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)* If there is a transmute attribute on the * directory mark the inode. */ +memset (&args,0 ,sizeof (args)); + args.dentry = dp; + args.inode = inode; + args.name =XATTR_NAME_SMACKTRANSMUTE ; + args.size =TRANS_TRUE_SIZE ;if (isp->smk_flags &SMK_INODE_CHANGED ) { isp->smk_flags &= ~SMK_INODE_CHANGED ; - rc =__vfs_setxattr (dp, inode, -XATTR_NAME_SMACKTRANSMUTE , -TRANS_TRUE ,TRANS_TRUE_SIZE , -0 ); + args.value =TRANS_TRUE ; + rc =__vfs_setxattr (&args); }else { - rc =__vfs_getxattr (dp, inode, -XATTR_NAME_SMACKTRANSMUTE , trattr, -TRANS_TRUE_SIZE ); + args.buffer = trattr; + args.flags =XATTR_NOSECURITY ; + rc =__vfs_getxattr (&args);if (rc >=0 &&strncmp (trattr,TRANS_TRUE ,TRANS_TRUE_SIZE ) !=0 ) rc = -EINVAL ;
Signature · 1 line
2.23.0.rc1.153.gdeed80330f-goog
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Mark,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc5 next-20190820]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mark-Salyzyn/Add-flags-option-to-get-xattr-method-paired-to-__vfs_getxattr/20190820-220307
config: um-x86_64_defconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-10) 7.4.0 reproduce:
# save the attached .config to linux build tree
make ARCH=um SUBARCH=x86_64If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
fs//kernfs/inode.c: In function 'kernfs_vfs_xattr_set':
>> fs//kernfs/inode.c:322:27: error: 'inode' undeclared (first use in this function)
struct kernfs_node *kn = inode->i_private;
^~~~~ fs//kernfs/inode.c:322:27: note: each undeclared identifier is reported only once for each function it appears in
vim +/inode +322 fs//kernfs/inode.c
b230d5aba2d1a7 Ondrej Mosnacek 2019-02-22 318
1537ad15c9c59c Ondrej Mosnacek 2019-04-03 319 static int kernfs_vfs_xattr_set(const struct xattr_handler *handler,
7d823b0879d4e2 Mark Salyzyn 2019-08-19 320 struct xattr_gs_args *args)
b230d5aba2d1a7 Ondrej Mosnacek 2019-02-22 321 {
b230d5aba2d1a7 Ondrej Mosnacek 2019-02-22 @322 struct kernfs_node *kn = inode->i_private;
b230d5aba2d1a7 Ondrej Mosnacek 2019-02-22 323
7d823b0879d4e2 Mark Salyzyn 2019-08-19 324 return kernfs_xattr_set(kn, xattr_full_name(handler, args->name),
7d823b0879d4e2 Mark Salyzyn 2019-08-19 325 args->value, args->size, args->flags);
b230d5aba2d1a7 Ondrej Mosnacek 2019-02-22 326 }
b230d5aba2d1a7 Ondrej Mosnacek 2019-02-22 327 :::::: The code at line 322 was first introduced by commit
:::::: b230d5aba2d1a7b0636408889a75bf9eae6b8bc7 LSM: add new hook for kernfs node initialization
:::::: TO: Ondrej Mosnacek <[email protected]> :::::: CC: Paul Moore <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Mark,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc5 next-20190820]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mark-Salyzyn/Add-flags-option-to-get-xattr-method-paired-to-__vfs_getxattr/20190820-220307
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-10) 7.4.0 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 If you fix the issue, kindly add following tag
All error/warnings (new ones prefixed by >>):
security/smack/smack_lsm.c: In function 'smk_fetch':
>> security/smack/smack_lsm.c:308:26: error: 'buffer' undeclared (first use in this function); did you mean 'user'?
skp = smk_import_entry(buffer, rc);
^~~~~~
user
security/smack/smack_lsm.c:308:26: note: each undeclared identifier is reported only once for each function it appears in
--
security/integrity/evm/evm_main.c: In function 'evm_find_protected_xattrs':
>> security/integrity/evm/evm_main.c:103:8: error: 'inode' undeclared (first use in this function)
if (!(inode->i_opflags & IOP_XATTR))
^~~~~
security/integrity/evm/evm_main.c:103:8: note: each undeclared identifier is reported only once for each function it appears in
>> security/integrity/evm/evm_main.c:109:14: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
args.flags = xattr->name;
^
--
In file included from include/linux/stat.h:7:0,
from include/linux/module.h:10,
from fs/9p/acl.c:15:
fs/9p/acl.c: In function 'v9fs_xattr_set_acl':
>> fs/9p/acl.c:258:14: error: 'inode' undeclared (first use in this function)
if (S_ISLNK(inode->i_mode))
^
include/uapi/linux/stat.h:21:23: note: in definition of macro 'S_ISLNK'
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
^
fs/9p/acl.c:258:14: note: each undeclared identifier is reported only once for each function it appears in
if (S_ISLNK(inode->i_mode))
^
include/uapi/linux/stat.h:21:23: note: in definition of macro 'S_ISLNK'
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
^
--
fs/afs/xattr.c: In function 'afs_xattr_get_cell':
>> fs/afs/xattr.c:334:6: error: 'size' undeclared (first use in this function); did you mean 'ksize'?
if (size == 0)
^~~~
ksize
fs/afs/xattr.c:334:6: note: each undeclared identifier is reported only once for each function it appears in
--
fs/ecryptfs/crypto.c: In function 'ecryptfs_write_metadata_to_xattr':
>> fs/ecryptfs/crypto.c:1131:23: error: 'args' undeclared (first use in this function); did you mean 'abs'?
rc = __vfs_setxattr(&args);
^~~~
abs
fs/ecryptfs/crypto.c:1131:23: note: each undeclared identifier is reported only once for each function it appears in
--
fs/ubifs/xattr.c: In function 'xattr_get':
>> fs/ubifs/xattr.c:676:63: error: 'name' undeclared (first use in this function); did you mean 'page'?
return ubifs_xattr_get(args->inode, xattr_full_name(handler, name),
^~~~
page
fs/ubifs/xattr.c:676:63: note: each undeclared identifier is reported only once for each function it appears in
fs/ubifs/xattr.c: In function 'xattr_set':
>> fs/ubifs/xattr.c:686:6: error: 'value' undeclared (first use in this function); did you mean 'false'?
if (value)
^~~~~
false
fs/ubifs/xattr.c:694:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
fs/ubifs/xattr.c: In function 'xattr_get':
fs/ubifs/xattr.c:678:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
--
fs/xfs/libxfs/xfs_attr.c: In function 'xfs_attr_set':
>> fs/xfs/libxfs/xfs_attr.c:327:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
args.value = value;
^vim +308 security/smack/smack_lsm.c
d166c8024d620d Casey Schaufler 2014-08-27 271
e114e473771c84 Casey Schaufler 2008-02-04 272 /**
e114e473771c84 Casey Schaufler 2008-02-04 273 * smk_fetch - Fetch the smack label from a file.
1a28979b322bb2 Lukasz Pawelczyk 2014-11-26 274 * @name: type of the label (attribute)
e114e473771c84 Casey Schaufler 2008-02-04 275 * @ip: a pointer to the inode
e114e473771c84 Casey Schaufler 2008-02-04 276 * @dp: a pointer to the dentry
e114e473771c84 Casey Schaufler 2008-02-04 277 *
e774ad683f425a Lukasz Pawelczyk 2015-04-20 278 * Returns a pointer to the master list entry for the Smack label,
e774ad683f425a Lukasz Pawelczyk 2015-04-20 279 * NULL if there was no label to fetch, or an error code.
e114e473771c84 Casey Schaufler 2008-02-04 280 */
2f823ff8bec03a Casey Schaufler 2013-05-22 281 static struct smack_known *smk_fetch(const char *name, struct inode *ip,
2f823ff8bec03a Casey Schaufler 2013-05-22 282 struct dentry *dp)
e114e473771c84 Casey Schaufler 2008-02-04 283 {
e114e473771c84 Casey Schaufler 2008-02-04 284 int rc;
2f823ff8bec03a Casey Schaufler 2013-05-22 285 struct smack_known *skp = NULL;
7d823b0879d4e2 Mark Salyzyn 2019-08-19 286 struct xattr_gs_args args;
e114e473771c84 Casey Schaufler 2008-02-04 287
5d6c31910bc071 Andreas Gruenbacher 2016-09-29 288 if (!(ip->i_opflags & IOP_XATTR))
e774ad683f425a Lukasz Pawelczyk 2015-04-20 289 return ERR_PTR(-EOPNOTSUPP);
e114e473771c84 Casey Schaufler 2008-02-04 290
7d823b0879d4e2 Mark Salyzyn 2019-08-19 291 memset(&args, 0, sizeof(args));
7d823b0879d4e2 Mark Salyzyn 2019-08-19 292 args.dentry = dp;
7d823b0879d4e2 Mark Salyzyn 2019-08-19 293 args.inode = ip;
7d823b0879d4e2 Mark Salyzyn 2019-08-19 294 args.name = name;
7d823b0879d4e2 Mark Salyzyn 2019-08-19 295 args.buffer = kzalloc(SMK_LONGLABEL, GFP_KERNEL);
7d823b0879d4e2 Mark Salyzyn 2019-08-19 296 args.size = SMK_LONGLABEL;
7d823b0879d4e2 Mark Salyzyn 2019-08-19 297 args.flags = XATTR_NOSECURITY;
7d823b0879d4e2 Mark Salyzyn 2019-08-19 298
7d823b0879d4e2 Mark Salyzyn 2019-08-19 299 if (args.buffer == NULL)
e774ad683f425a Lukasz Pawelczyk 2015-04-20 300 return ERR_PTR(-ENOMEM);
e114e473771c84 Casey Schaufler 2008-02-04 301
7d823b0879d4e2 Mark Salyzyn 2019-08-19 302 rc = __vfs_getxattr(&args);
e774ad683f425a Lukasz Pawelczyk 2015-04-20 303 if (rc < 0)
e774ad683f425a Lukasz Pawelczyk 2015-04-20 304 skp = ERR_PTR(rc);
e774ad683f425a Lukasz Pawelczyk 2015-04-20 305 else if (rc == 0)
e774ad683f425a Lukasz Pawelczyk 2015-04-20 306 skp = NULL;
e774ad683f425a Lukasz Pawelczyk 2015-04-20 307 else
2f823ff8bec03a Casey Schaufler 2013-05-22 @308 skp = smk_import_entry(buffer, rc);
f7112e6c9abf1c Casey Schaufler 2012-05-06 309
f7112e6c9abf1c Casey Schaufler 2012-05-06 310 kfree(buffer);
f7112e6c9abf1c Casey Schaufler 2012-05-06 311
2f823ff8bec03a Casey Schaufler 2013-05-22 312 return skp;
e114e473771c84 Casey Schaufler 2008-02-04 313 }
e114e473771c84 Casey Schaufler 2008-02-04 314 :::::: The code at line 308 was first introduced by commit
:::::: 2f823ff8bec03a1e6f9e11fd0c4d54e4c7d09532 Smack: Improve access check performance
:::::: TO: Casey Schaufler <[email protected]> :::::: CC: Casey Schaufler <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation