Re: [PATCH] fs: introduce getfsxattrat and setfsxattrat syscalls

From: kernel test robot
Date: Sun Jan 12 2025 - 22:25:54 EST


Hi Andrey,

kernel test robot noticed the following build warnings:

[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on geert-m68k/for-next powerpc/next powerpc/fixes s390/features linus/master v6.13-rc6 next-20250110]
[cannot apply to geert-m68k/for-linus deller-parisc/for-next jcmvbkbc-xtensa/xtensa-for-next arnd-asm-generic/master tip/x86/asm]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Andrey-Albershteyn/fs-introduce-getfsxattrat-and-setfsxattrat-syscalls/20250110-014739
base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link: https://lore.kernel.org/r/20250109174540.893098-1-aalbersh%40kernel.org
patch subject: [PATCH] fs: introduce getfsxattrat and setfsxattrat syscalls
config: m68k-randconfig-r122-20250111 (https://download.01.org/0day-ci/archive/20250113/202501131033.KKMmoHBV-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 14.2.0
reproduce: (https://download.01.org/0day-ci/archive/20250113/202501131033.KKMmoHBV-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501131033.KKMmoHBV-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
fs/inode.c:957:24: sparse: sparse: context imbalance in 'inode_lru_isolate' - wrong count at exit
fs/inode.c:1058:9: sparse: sparse: context imbalance in 'find_inode' - different lock contexts for basic block
fs/inode.c:1099:9: sparse: sparse: context imbalance in 'find_inode_fast' - different lock contexts for basic block
fs/inode.c:1829:5: sparse: sparse: context imbalance in 'insert_inode_locked' - wrong count at exit
fs/inode.c:1947:20: sparse: sparse: context imbalance in 'iput_final' - unexpected unlock
fs/inode.c:1961:6: sparse: sparse: context imbalance in 'iput' - wrong count at exit
fs/inode.c:2494:17: sparse: sparse: context imbalance in '__wait_on_freeing_inode' - unexpected unlock
>> fs/inode.c:2998:39: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct fsxattr [noderef] __user *ufa @@ got struct fsxattr *fsx @@
fs/inode.c:2998:39: sparse: expected struct fsxattr [noderef] __user *ufa
fs/inode.c:2998:39: sparse: got struct fsxattr *fsx
fs/inode.c:3032:41: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct fsxattr [noderef] __user *ufa @@ got struct fsxattr *fsx @@
fs/inode.c:3032:41: sparse: expected struct fsxattr [noderef] __user *ufa
fs/inode.c:3032:41: sparse: got struct fsxattr *fsx

vim +2998 fs/inode.c

2959
2960 SYSCALL_DEFINE4(getfsxattrat, int, dfd, const char __user *, filename,
2961 struct fsxattr *, fsx, int, at_flags)
2962 {
2963 struct fd dir;
2964 struct fileattr fa;
2965 struct path filepath;
2966 struct inode *inode;
2967 int error;
2968
2969 if (at_flags)
2970 return -EINVAL;
2971
2972 if (!capable(CAP_FOWNER))
2973 return -EPERM;
2974
2975 dir = fdget(dfd);
2976 if (!fd_file(dir))
2977 return -EBADF;
2978
2979 if (!S_ISDIR(file_inode(fd_file(dir))->i_mode)) {
2980 error = -EBADF;
2981 goto out;
2982 }
2983
2984 error = user_path_at(dfd, filename, at_flags, &filepath);
2985 if (error)
2986 goto out;
2987
2988 inode = filepath.dentry->d_inode;
2989 if (file_inode(fd_file(dir))->i_sb->s_magic != inode->i_sb->s_magic) {
2990 error = -EBADF;
2991 goto out_path;
2992 }
2993
2994 error = vfs_fileattr_get(filepath.dentry, &fa);
2995 if (error)
2996 goto out_path;
2997
> 2998 if (copy_fsxattr_to_user(&fa, fsx))
2999 error = -EFAULT;
3000
3001 out_path:
3002 path_put(&filepath);
3003 out:
3004 fdput(dir);
3005 return error;
3006 }
3007

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki