lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <201905231720.XVaE4IT9%lkp@intel.com>
Date:   Thu, 23 May 2019 17:50:30 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Marco Elver <elver@...gle.com>
Cc:     kbuild-all@...org, aryabinin@...tuozzo.com, dvyukov@...gle.com,
        glider@...gle.com, andreyknvl@...gle.com,
        akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, kasan-dev@...glegroups.com,
        Marco Elver <elver@...gle.com>
Subject: Re: [PATCH] mm/kasan: Print frame description for stack bugs

Hi Marco,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.2-rc1 next-20190522]
[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-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.4.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.4.0 make.cross ARCH=xtensa 

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

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:7:0,
                    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:0,
                    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:0,
                    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 +/pr_err +233 mm/kasan/report.c

   214	
   215	static void print_decoded_frame_descr(const char *frame_descr)
   216	{
   217		/*
   218		 * We need to parse the following string:
   219		 *    "n alloc_1 alloc_2 ... alloc_n"
   220		 * where alloc_i looks like
   221		 *    "offset size len name"
   222		 * or "offset size len name:line".
   223		 */
   224	
   225		char token[64];
   226		unsigned long num_objects;
   227	
   228		if (!tokenize_frame_descr(&frame_descr, token, sizeof(token),
   229					  &num_objects))
   230			return;
   231	
   232		pr_err("\n");
 > 233		pr_err("this frame has %zu %s:\n", num_objects,
   234		       num_objects == 1 ? "object" : "objects");
   235	
   236		while (num_objects--) {
   237			unsigned long offset;
   238			unsigned long size;
   239	
   240			/* access offset */
   241			if (!tokenize_frame_descr(&frame_descr, token, sizeof(token),
   242						  &offset))
   243				return;
   244			/* access size */
   245			if (!tokenize_frame_descr(&frame_descr, token, sizeof(token),
   246						  &size))
   247				return;
   248			/* name length (unused) */
   249			if (!tokenize_frame_descr(&frame_descr, NULL, 0, NULL))
   250				return;
   251			/* object name */
   252			if (!tokenize_frame_descr(&frame_descr, token, sizeof(token),
   253						  NULL))
   254				return;
   255	
   256			/* Strip line number, if it exists. */
   257			strreplace(token, ':', '\0');
   258	
   259			/* Finally, print object information. */
   260			pr_err(" [%zu, %zu) '%s'", offset, offset + size, token);
   261		}
   262	}
   263	

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

Download attachment ".config.gz" of type "application/gzip" (57377 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ