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

From: kernel test robot
Date: Wed Aug 16 2023 - 05:18:45 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-20230815]
[cannot apply to linus/master v6.5-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/20230816-150412
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230816065925.850879-3-usama.anjum%40collabora.com
patch subject: [PATCH v30 2/6] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230816/202308161737.upLWpu8Q-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230816/202308161737.upLWpu8Q-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/202308161737.upLWpu8Q-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_get_args':
>> fs/proc/task_mmu.c:2269:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2269 | if (!access_ok((void __user *)arg->start, arg->end - arg->start))
| ^
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:2269:14: note: in expansion of macro 'access_ok'
2269 | if (!access_ok((void __user *)arg->start, arg->end - arg->start))
| ^~~~~~~~~
fs/proc/task_mmu.c:2273:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2273 | if (arg->vec && !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:2273:26: note: in expansion of macro 'access_ok'
2273 | if (arg->vec && !access_ok((void __user *)arg->vec,
| ^~~~~~~~~
fs/proc/task_mmu.c: In function 'pagemap_scan_init_bounce_buffer':
fs/proc/task_mmu.c:2310:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2310 | p->vec_out = (struct page_region __user *)p->arg.vec;
| ^
fs/proc/task_mmu.c: At top level:
fs/proc/task_mmu.c:1998:13: warning: 'pagemap_scan_backout_range' defined but not used [-Wunused-function]
1998 | static void pagemap_scan_backout_range(struct pagemap_scan_private *p,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~


vim +2269 fs/proc/task_mmu.c

2245
2246 static int pagemap_scan_get_args(struct pm_scan_arg *arg,
2247 unsigned long uarg)
2248 {
2249 if (copy_from_user(arg, (void __user *)uarg, sizeof(*arg)))
2250 return -EFAULT;
2251
2252 if (arg->size != sizeof(struct pm_scan_arg))
2253 return -EINVAL;
2254
2255 /* Validate requested features */
2256 if (arg->flags & ~PM_SCAN_FLAGS)
2257 return -EINVAL;
2258 if ((arg->category_inverted | arg->category_mask |
2259 arg->category_anyof_mask | arg->return_mask) & ~PM_SCAN_CATEGORIES)
2260 return -EINVAL;
2261
2262 arg->start = untagged_addr((unsigned long)arg->start);
2263 arg->end = untagged_addr((unsigned long)arg->end);
2264 arg->vec = untagged_addr((unsigned long)arg->vec);
2265
2266 /* Validate memory pointers */
2267 if (!IS_ALIGNED(arg->start, PAGE_SIZE))
2268 return -EINVAL;
> 2269 if (!access_ok((void __user *)arg->start, arg->end - arg->start))
2270 return -EFAULT;
2271 if (!arg->vec && arg->vec_len)
2272 return -EINVAL;
2273 if (arg->vec && !access_ok((void __user *)arg->vec,
2274 arg->vec_len * sizeof(struct page_region)))
2275 return -EFAULT;
2276
2277 /* Fixup default values */
2278 arg->end = ALIGN(arg->end, PAGE_SIZE);
2279 arg->walk_end = 0;
2280 if (!arg->max_pages)
2281 arg->max_pages = ULONG_MAX;
2282
2283 return 0;
2284 }
2285

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