Re: [PATCH] prctl: Get private anonymous memory region name

From: kernel test robot
Date: Sat Nov 25 2023 - 15:01:05 EST


Hi Rong,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.7-rc2 next-20231124]
[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/Rong-Tao/prctl-Get-private-anonymous-memory-region-name/20231125-220925
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/tencent_977CBF8E8CA6234A1B740A35655D5D7EAA0A%40qq.com
patch subject: [PATCH] prctl: Get private anonymous memory region name
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20231126/202311260314.iuUprWJb-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231126/202311260314.iuUprWJb-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/202311260314.iuUprWJb-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

kernel/sys.c: In function 'prctl_get_vma':
>> kernel/sys.c:2389:35: warning: passing argument 1 of 'anon_vma_name_put' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2389 | anon_vma_name_put(anon_name);
| ^~~~~~~~~
In file included from kernel/sys.c:10:
include/linux/mm_inline.h:363:60: note: expected 'struct anon_vma_name *' but argument is of type 'const struct anon_vma_name *'
363 | static inline void anon_vma_name_put(struct anon_vma_name *anon_name)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~


vim +2389 kernel/sys.c

2361
2362 static int prctl_get_vma(unsigned long opt, unsigned long addr,
2363 unsigned long buf, unsigned long arg)
2364 {
2365 struct mm_struct *mm = current->mm;
2366 const char __user *u_buf;
2367 int error;
2368
2369 switch (opt) {
2370 case PR_GET_VMA_ANON_NAME:
2371 const struct anon_vma_name *anon_name = NULL;
2372
2373 u_buf = (const char __user *)buf;
2374 error = 0;
2375
2376 mmap_read_lock(mm);
2377 anon_name = madvise_get_anon_name(mm, addr);
2378 if (!anon_name) {
2379 mmap_read_unlock(mm);
2380 error = -EFAULT;
2381 break;
2382 }
2383
2384 if (copy_to_user((char __user *)u_buf, anon_name->name,
2385 strlen(anon_name->name) + 1))
2386 error = -EFAULT;
2387
2388 mmap_read_unlock(mm);
> 2389 anon_vma_name_put(anon_name);
2390 break;
2391 default:
2392 error = -EINVAL;
2393 }
2394 return error;
2395 }
2396

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