Re: [PATCH v3 2/6] riscv: Rework kasan population functions

From: Alexandre Ghiti
Date: Thu Feb 02 2023 - 09:00:32 EST


On Wed, Feb 1, 2023 at 1:16 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Alexandre,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v6.2-rc6 next-20230131]
> [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/Alexandre-Ghiti/riscv-Split-early-and-final-KASAN-population-functions/20230125-163113
> patch link: https://lore.kernel.org/r/20230125082333.1577572-3-alexghiti%40rivosinc.com
> patch subject: [PATCH v3 2/6] riscv: Rework kasan population functions
> config: riscv-randconfig-r006-20230201 (https://download.01.org/0day-ci/archive/20230201/202302010819.RAsjyv6V-lkp@xxxxxxxxx/config)
> compiler: riscv64-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/c18726e8d14edbd59ec19854b4eb06d83fff716f
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Alexandre-Ghiti/riscv-Split-early-and-final-KASAN-population-functions/20230125-163113
> git checkout c18726e8d14edbd59ec19854b4eb06d83fff716f
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/mm/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> >> arch/riscv/mm/kasan_init.c:442:6: warning: no previous prototype for 'create_tmp_mapping' [-Wmissing-prototypes]
> 442 | void create_tmp_mapping(void)
> | ^~~~~~~~~~~~~~~~~~
>
>
> vim +/create_tmp_mapping +442 arch/riscv/mm/kasan_init.c
>
> 441
> > 442 void create_tmp_mapping(void)
> 443 {
> 444 void *ptr;
> 445 p4d_t *base_p4d;
> 446
> 447 /*
> 448 * We need to clean the early mapping: this is hard to achieve "in-place",
> 449 * so install a temporary mapping like arm64 and x86 do.
> 450 */
> 451 memcpy(tmp_pg_dir, swapper_pg_dir, sizeof(pgd_t) * PTRS_PER_PGD);
> 452
> 453 /* Copy the last p4d since it is shared with the kernel mapping. */
> 454 if (pgtable_l5_enabled) {
> 455 ptr = (p4d_t *)pgd_page_vaddr(*pgd_offset_k(KASAN_SHADOW_END));
> 456 memcpy(tmp_p4d, ptr, sizeof(p4d_t) * PTRS_PER_P4D);
> 457 set_pgd(&tmp_pg_dir[pgd_index(KASAN_SHADOW_END)],
> 458 pfn_pgd(PFN_DOWN(__pa(tmp_p4d)), PAGE_TABLE));
> 459 base_p4d = tmp_p4d;
> 460 } else {
> 461 base_p4d = (p4d_t *)tmp_pg_dir;
> 462 }
> 463
> 464 /* Copy the last pud since it is shared with the kernel mapping. */
> 465 if (pgtable_l4_enabled) {
> 466 ptr = (pud_t *)p4d_page_vaddr(*(base_p4d + p4d_index(KASAN_SHADOW_END)));
> 467 memcpy(tmp_pud, ptr, sizeof(pud_t) * PTRS_PER_PUD);
> 468 set_p4d(&base_p4d[p4d_index(KASAN_SHADOW_END)],
> 469 pfn_p4d(PFN_DOWN(__pa(tmp_pud)), PAGE_TABLE));
> 470 }
> 471 }
> 472

Ok, I have to declare this function static to quiet this warning,
there will be a v4 soon then.

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