Re: [PATCH] mm/kasan: Print frame description for stack bugs

From: kbuild test robot
Date: Sat May 18 2019 - 16:52:17 EST


Hi Marco,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.1 next-20190517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Marco-Elver/mm-kasan-Print-frame-description-for-stack-bugs/20190519-040214
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.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=8.1.0 make.cross ARCH=xtensa

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

All warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:7,
from include/linux/kernel.h:15,
from include/linux/kallsyms.h:10,
from include/linux/ftrace.h:11,
from mm/kasan/report.c:18:
mm/kasan/report.c: In function 'print_decoded_frame_descr':
>> include/linux/kern_levels.h:5:18: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat=]
#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__)
^~~~~~~~
mm/kasan/report.c:233:2: note: in expansion of macro 'pr_err'
pr_err("this frame has %zu %s:\n", num_objects,
^~~~~~
mm/kasan/report.c:233:27: note: format string is defined here
pr_err("this frame has %zu %s:\n", num_objects,
~~^
%lu
In file included from include/linux/printk.h:7,
from include/linux/kernel.h:15,
from include/linux/kallsyms.h:10,
from include/linux/ftrace.h:11,
from mm/kasan/report.c:18:
>> include/linux/kern_levels.h:5:18: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat=]
#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__)
^~~~~~~~
mm/kasan/report.c:260:3: note: in expansion of macro 'pr_err'
pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
^~~~~~
mm/kasan/report.c:260:15: note: format string is defined here
pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
~~^
%lu
In file included from include/linux/printk.h:7,
from include/linux/kernel.h:15,
from include/linux/kallsyms.h:10,
from include/linux/ftrace.h:11,
from mm/kasan/report.c:18:
include/linux/kern_levels.h:5:18: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat=]
#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__)
^~~~~~~~
mm/kasan/report.c:260:3: note: in expansion of macro 'pr_err'
pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
^~~~~~
mm/kasan/report.c:260:20: note: format string is defined here
pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
~~^
%lu
--
In file included from include/linux/printk.h:7,
from include/linux/kernel.h:15,
from include/linux/kallsyms.h:10,
from include/linux/ftrace.h:11,
from mm//kasan/report.c:18:
mm//kasan/report.c: In function 'print_decoded_frame_descr':
>> include/linux/kern_levels.h:5:18: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat=]
#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__)
^~~~~~~~
mm//kasan/report.c:233:2: note: in expansion of macro 'pr_err'
pr_err("this frame has %zu %s:\n", num_objects,
^~~~~~
mm//kasan/report.c:233:27: note: format string is defined here
pr_err("this frame has %zu %s:\n", num_objects,
~~^
%lu
In file included from include/linux/printk.h:7,
from include/linux/kernel.h:15,
from include/linux/kallsyms.h:10,
from include/linux/ftrace.h:11,
from mm//kasan/report.c:18:
>> include/linux/kern_levels.h:5:18: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'long unsigned int' [-Wformat=]
#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__)
^~~~~~~~
mm//kasan/report.c:260:3: note: in expansion of macro 'pr_err'
pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
^~~~~~
mm//kasan/report.c:260:15: note: format string is defined here
pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
~~^
%lu
In file included from include/linux/printk.h:7,
from include/linux/kernel.h:15,
from include/linux/kallsyms.h:10,
from include/linux/ftrace.h:11,
from mm//kasan/report.c:18:
include/linux/kern_levels.h:5:18: warning: format '%zu' expects argument of type 'size_t', but argument 3 has type 'long unsigned int' [-Wformat=]
#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__)
^~~~~~~~
mm//kasan/report.c:260:3: note: in expansion of macro 'pr_err'
pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
^~~~~~
mm//kasan/report.c:260:20: note: format string is defined here
pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
~~^
%lu

vim +5 include/linux/kern_levels.h

314ba352 Joe Perches 2012-07-30 4
04d2c8c8 Joe Perches 2012-07-30 @5 #define KERN_SOH "\001" /* ASCII Start Of Header */
04d2c8c8 Joe Perches 2012-07-30 6 #define KERN_SOH_ASCII '\001'
04d2c8c8 Joe Perches 2012-07-30 7

:::::: The code at line 5 was first introduced by commit
:::::: 04d2c8c83d0e3ac5f78aeede51babb3236200112 printk: convert the format for KERN_<LEVEL> to a 2 byte pattern

:::::: TO: Joe Perches <joe@xxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip