tree:
https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git kcsan/rework
head: d23e0222d49db5884782997974d9d7449d739e5b
commit: d23e0222d49db5884782997974d9d7449d739e5b [8/8] kcsan: report observed value
changes
config: x86_64-randconfig-a016-20200914 (attached as .config)
compiler: clang version 12.0.0 (
https://github.com/llvm/llvm-project
3ed89b51da38f081fedb57727076262abb81d149)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout d23e0222d49db5884782997974d9d7449d739e5b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> kernel/kcsan/report.c:415:14: warning: format specifies type
'unsigned long' but the argument has type 'u64' (aka 'unsigned long
long') [-Wformat]
hex_len, old, hex_len,
new);
^~~
include/linux/printk.h:339:33: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
kernel/kcsan/report.c:415:28: warning: format specifies type 'unsigned long'
but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
hex_len, old, hex_len, new);
^~~
include/linux/printk.h:339:33: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
kernel/kcsan/report.c:417:14: warning: format specifies type 'unsigned long'
but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
hex_len, diff, hex_len, mask);
^~~~
include/linux/printk.h:339:33: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
kernel/kcsan/report.c:417:29: warning: format specifies type 'unsigned long'
but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
hex_len, diff, hex_len, mask);
^~~~
include/linux/printk.h:339:33: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
4 warnings generated.
#
https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?id...
git remote add mark-rutland
https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git
git fetch --no-tags mark-rutland kcsan/rework
git checkout d23e0222d49db5884782997974d9d7449d739e5b
vim +415 kernel/kcsan/report.c
322
323 static void print_report(enum kcsan_value_change value_change,
324 const struct access_info *ai,
325 const struct other_info *other_info,
326 u64 old, u64 new, u64 mask)
327 {
328 unsigned long stack_entries[NUM_STACK_ENTRIES] = { 0 };
329 int num_stack_entries = stack_trace_save(stack_entries, NUM_STACK_ENTRIES, 1);
330 int skipnr = get_stack_skipnr(stack_entries, num_stack_entries);
331 unsigned long this_frame = stack_entries[skipnr];
332 unsigned long other_frame = 0;
333 int other_skipnr = 0; /* silence uninit warnings */
334
335 /*
336 * Must check report filter rules before starting to print.
337 */
338 if (skip_report(KCSAN_VALUE_CHANGE_TRUE, stack_entries[skipnr]))
339 return;
340
341 if (other_info) {
342 other_skipnr = get_stack_skipnr(other_info->stack_entries,
343 other_info->num_stack_entries);
344 other_frame = other_info->stack_entries[other_skipnr];
345
346 /* @value_change is only known for the other thread */
347 if (skip_report(value_change, other_frame))
348 return;
349 }
350
351 if (rate_limit_report(this_frame, other_frame))
352 return;
353
354 /* Print report header. */
355 pr_err("==================================================================\n");
356 if (other_info) {
357 int cmp;
358
359 /*
360 * Order functions lexographically for consistent bug titles.
361 * Do not print offset of functions to keep title short.
362 */
363 cmp = sym_strcmp((void *)other_frame, (void *)this_frame);
364 pr_err("BUG: KCSAN: %s in %ps / %ps\n",
365 get_bug_type(ai->access_type | other_info->ai.access_type),
366 (void *)(cmp < 0 ? other_frame : this_frame),
367 (void *)(cmp < 0 ? this_frame : other_frame));
368 } else {
369 pr_err("BUG: KCSAN: %s in %pS\n", get_bug_type(ai->access_type),
370 (void *)this_frame);
371 }
372
373 pr_err("\n");
374
375 /* Print information about the racing accesses. */
376 if (other_info) {
377 pr_err("%s to 0x%px of %zu bytes by %s on cpu %i:\n",
378 get_access_type(other_info->ai.access_type), other_info->ai.ptr,
379 other_info->ai.size, get_thread_desc(other_info->ai.task_pid),
380 other_info->ai.cpu_id);
381
382 /* Print the other thread's stack trace. */
383 stack_trace_print(other_info->stack_entries + other_skipnr,
384 other_info->num_stack_entries - other_skipnr,
385 0);
386
387 if (IS_ENABLED(CONFIG_KCSAN_VERBOSE))
388 print_verbose_info(other_info->task);
389
390 pr_err("\n");
391 pr_err("%s to 0x%px of %zu bytes by %s on cpu %i:\n",
392 get_access_type(ai->access_type), ai->ptr, ai->size,
393 get_thread_desc(ai->task_pid), ai->cpu_id);
394 } else {
395 pr_err("race at unknown origin, with %s to 0x%px of %zu bytes by %s on cpu
%i:\n",
396 get_access_type(ai->access_type), ai->ptr, ai->size,
397 get_thread_desc(ai->task_pid), ai->cpu_id);
398 }
399 /* Print stack trace of this thread. */
400 stack_trace_print(stack_entries + skipnr, num_stack_entries - skipnr,
401 0);
402
403 if (IS_ENABLED(CONFIG_KCSAN_VERBOSE))
404 print_verbose_info(current);
405
406 /* Print observed value change */
407 if (ai->size <= 8) {
408 int hex_len = ai->size * 2;
409 u64 diff = old ^ new;
410 if (mask)
411 diff &= mask;
412 if (diff) {
413 pr_err("\n");
414 pr_err("value changed from 0x%0*lx to 0x%0*lx\n",
415 hex_len, old, hex_len, new);
416 pr_err("bits changed 0x%0*lx with mask 0x%0*lx\n",
417 hex_len, diff, hex_len, mask);
418 }
419 }
420
421 /* Print report footer. */
422 pr_err("\n");
423 pr_err("Reported by Kernel Concurrency Sanitizer on:\n");
424 dump_stack_print_info(KERN_DEFAULT);
425 pr_err("==================================================================\n");
426
427 if (panic_on_warn)
428 panic("panic_on_warn set ...\n");
429 }
430
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org