Re: [PATCH v2 4/4] powerpc: Book3S 64-bit "heavyweight" KASAN support

From: kbuild test robot
Date: Tue Dec 10 2019 - 06:20:57 EST


Hi Daniel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20191209]
[also build test ERROR on linus/master v5.5-rc1]
[cannot apply to powerpc/next asm-generic/master v5.4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Daniel-Axtens/KASAN-for-powerpc64-radix-plus-generic-mm-change/20191210-171342
base: 6cf8298daad041cd15dc514d8a4f93ca3636c84e
config: powerpc-allnoconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from arch/powerpc/kernel/prom.c:15:
arch/powerpc/kernel/prom.c: In function 'early_reserve_mem':
>> include/linux/kern_levels.h:5:18: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'phys_addr_t {aka unsigned int}' [-Werror=format=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
include/linux/printk.h:304:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~
>> arch/powerpc/kernel/prom.c:694:4: note: in expansion of macro 'pr_err'
pr_err("===========================================\n"
^~~~~~
arch/powerpc/kernel/prom.c:697:48: note: format string is defined here
"The actual physical memory detected is %llu MB.\n"
~~~^
%u
cc1: all warnings being treated as errors
--
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from arch/powerpc//kernel/prom.c:15:
arch/powerpc//kernel/prom.c: In function 'early_reserve_mem':
>> include/linux/kern_levels.h:5:18: error: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'phys_addr_t {aka unsigned int}' [-Werror=format=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
include/linux/printk.h:304:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~
arch/powerpc//kernel/prom.c:694:4: note: in expansion of macro 'pr_err'
pr_err("===========================================\n"
^~~~~~
arch/powerpc//kernel/prom.c:697:48: note: format string is defined here
"The actual physical memory detected is %llu MB.\n"
~~~^
%u
cc1: all warnings being treated as errors

vim +/pr_err +694 arch/powerpc/kernel/prom.c

675
676 if (IS_ENABLED(CONFIG_KASAN) && IS_ENABLED(CONFIG_PPC_BOOK3S_64)) {
677 kasan_memory_size =
678 ((phys_addr_t)CONFIG_PHYS_MEM_SIZE_FOR_KASAN << 20);
679
680 if (top_phys_addr < kasan_memory_size) {
681 /*
682 * We are doomed. Attempts to call e.g. panic() are
683 * likely to fail because they call out into
684 * instrumented code, which will almost certainly
685 * access memory beyond the end of physical
686 * memory. Hang here so that at least the NIP points
687 * somewhere that will help you debug it if you look at
688 * it in qemu.
689 */
690 while (true)
691 ;
692 } else if (top_phys_addr > kasan_memory_size) {
693 /* print a biiiig warning in hopes people notice */
> 694 pr_err("===========================================\n"
695 "Physical memory exceeds compiled-in maximum!\n"
696 "This kernel was compiled for KASAN with %u MB physical memory.\n"
697 "The actual physical memory detected is %llu MB.\n"
698 "Memory above the compiled limit will not be used!\n"
699 "===========================================\n",
700 CONFIG_PHYS_MEM_SIZE_FOR_KASAN,
701 top_phys_addr / (1024 * 1024));
702 }
703
704 kasan_shadow_start = _ALIGN_DOWN(kasan_memory_size * 7 / 8,
705 PAGE_SIZE);
706 DBG("reserving %llx -> %llx for KASAN",
707 kasan_shadow_start, top_phys_addr);
708 memblock_reserve(kasan_shadow_start,
709 top_phys_addr - kasan_shadow_start);
710 }
711 }
712

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip