Re: [PATCH v19 2/5] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs

From: kernel test robot
Date: Thu Jun 15 2023 - 12:42:52 EST


Hi Muhammad,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on next-20230615]
[cannot apply to linus/master v6.4-rc6]
[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/Muhammad-Usama-Anjum/userfaultfd-UFFD_FEATURE_WP_ASYNC/20230615-225037
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230615141144.665148-3-usama.anjum%40collabora.com
patch subject: [PATCH v19 2/5] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230616/202306160006.dNg0cOoc-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
git fetch akpm-mm mm-everything
git checkout akpm-mm/mm-everything
b4 shazam https://lore.kernel.org/r/20230615141144.665148-3-usama.anjum@xxxxxxxxxxxxx
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash fs/proc/

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/202306160006.dNg0cOoc-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/asm-generic/bug.h:5,
from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:6,
from include/linux/pagewalk.h:5,
from fs/proc/task_mmu.c:2:
fs/proc/task_mmu.c: In function 'pagemap_scan_args_valid':
>> fs/proc/task_mmu.c:2148:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2148 | if (!access_ok((void __user *)arg->vec,
| ^
include/linux/compiler.h:76:45: note: in definition of macro 'likely'
76 | # define likely(x) __builtin_expect(!!(x), 1)
| ^
fs/proc/task_mmu.c:2148:22: note: in expansion of macro 'access_ok'
2148 | if (!access_ok((void __user *)arg->vec,
| ^~~~~~~~~


vim +2148 fs/proc/task_mmu.c

2115
2116 static int pagemap_scan_args_valid(struct pm_scan_arg *arg, unsigned long start,
2117 struct page_region __user *vec)
2118 {
2119 /* Detect illegal size, flags, len and masks */
2120 if (arg->size != sizeof(struct pm_scan_arg))
2121 return -EINVAL;
2122 if (!arg->flags)
2123 return -EINVAL;
2124 if (arg->flags & ~PM_SCAN_OPS)
2125 return -EINVAL;
2126 if (!arg->len)
2127 return -EINVAL;
2128 if ((arg->required_mask | arg->anyof_mask | arg->excluded_mask |
2129 arg->return_mask) & ~PM_SCAN_BITS_ALL)
2130 return -EINVAL;
2131 if (!arg->required_mask && !arg->anyof_mask &&
2132 !arg->excluded_mask)
2133 return -EINVAL;
2134 if (!arg->return_mask)
2135 return -EINVAL;
2136
2137 /* Validate memory range */
2138 if (!IS_ALIGNED(start, PAGE_SIZE))
2139 return -EINVAL;
2140 if (!access_ok((void __user *)start, arg->len))
2141 return -EFAULT;
2142
2143 if (IS_PM_SCAN_GET(arg->flags)) {
2144 if (!arg->vec)
2145 return -EINVAL;
2146 if (arg->vec_len == 0)
2147 return -EINVAL;
> 2148 if (!access_ok((void __user *)arg->vec,
2149 arg->vec_len * sizeof(struct page_region)))
2150 return -EFAULT;
2151 }
2152
2153 if (IS_PM_SCAN_WP(arg->flags) && !IS_PM_SCAN_GET(arg->flags) &&
2154 arg->max_pages)
2155 return -EINVAL;
2156
2157 return 0;
2158 }
2159

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