Re: [bpf-next v4 1/3] mm: add copy_remote_vm_str

kernel test robot
2025-01-26T14:29:48Z

Hi Jordan,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master linus/master v6.13 next-20250124]
[cannot apply to akpm-mm/mm-everything]
[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/Jordan-Rome/bpf-Add-bpf_copy_from_user_task_str-kfunc/20250126-204439
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20250126124147.3154108-1-linux%40jordanrome.com
patch subject: [bpf-next v4 1/3] mm: add copy_remote_vm_str
config: arm-randconfig-001-20250126 (https://download.01.org/0day-ci/archive/20250126/202501262241.ZEkByWKM-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250126/202501262241.ZEkByWKM-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501262241.ZEkByWKM-lkp@intel.com/

All errors (new ones prefixed by >>):

mm/nommu.c: In function '__copy_remote_vm_str':
>> mm/nommu.c:1717:9: error: 'vma' undeclared (first use in this function); did you mean 'vmap'?
1717 | vma = find_vma(mm, addr);
| ^~~
| vmap
mm/nommu.c:1717:9: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/bitmap.h:13,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:63,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/nommu.c:20:
>> mm/nommu.c:1725:44: error: passing argument 2 of 'sized_strscpy' makes pointer from integer without a cast [-Wint-conversion]
1725 | ret = strscpy(buf, addr, len);
| ^~~~
| |
| long unsigned int
include/linux/string.h:82:28: note: in definition of macro '__strscpy1'
82 | sized_strscpy(dst, src, size + __must_be_cstr(dst) + __must_be_cstr(src))
| ^~~
mm/nommu.c:1725:31: note: in expansion of macro 'strscpy'
1725 | ret = strscpy(buf, addr, len);
| ^~~~~~~
include/linux/string.h:72:31: note: expected 'const char *' but argument is of type 'long unsigned int'
72 | ssize_t sized_strscpy(char *, const char *, size_t);
| ^~~~~~~~~~~~

vim +1717 mm/nommu.c

1703
1704 /*
1705 * Copy a string from another process's address space as given in mm.
1706 * If there is any error return -EFAULT.
1707 */
1708 static int __copy_remote_vm_str(struct mm_struct *mm, unsigned long addr,
1709 void *buf, int len)
1710 {
1711 int ret;
1712
1713 if (mmap_read_lock_killable(mm))
1714 return -EFAULT;
1715
1716 /* the access must start within one of the target process's mappings */
> 1717 vma = find_vma(mm, addr);
1718 if (vma) {
1719 /* don't overrun this mapping */
1720 if (addr + len >= vma->vm_end)
1721 len = vma->vm_end - addr;
1722
1723 /* only read mappings where it is permitted */
1724 if (vma->vm_flags & VM_MAYREAD) {
> 1725 ret = strscpy(buf, addr, len);
1726 if (ret < 0)
1727 ret = len - 1;
1728 } else {
1729 ret = -EFAULT;
1730 }
1731 } else {
1732 ret = -EFAULT;
1733 }
1734
1735 mmap_read_unlock(mm);
1736 return ret;
1737 }
1738

--
0-DAY CI Kernel Test Service