* [ammarfaizi2-block:tglx/devel/depthtracking 45/45] arch/x86/kernel/callthunks.c:419:11: warning: variable 'nthunks' set but not used
@ 2022-07-21 8:59 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-07-21 8:59 UTC (permalink / raw)
To: Thomas Gleixner
Cc: llvm, kbuild-all, Ammar Faizi, GNU/Weeb Mailing List,
linux-kernel
tree: https://github.com/ammarfaizi2/linux-block tglx/devel/depthtracking
head: 714d29e3e7e3faac27142424ae2533163ddd3a46
commit: 714d29e3e7e3faac27142424ae2533163ddd3a46 [45/45] x06/callthunks: Put thunks into compiler provided padding area
config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220721/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0c1b32717bcffcf8edf95294e98933bd4c1e76ed)
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/ammarfaizi2/linux-block/commit/714d29e3e7e3faac27142424ae2533163ddd3a46
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block tglx/devel/depthtracking
git checkout 714d29e3e7e3faac27142424ae2533163ddd3a46
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kernel/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
>> arch/x86/kernel/callthunks.c:419:11: warning: variable 'nthunks' set but not used [-Wunused-but-set-variable]
int gap, nthunks = 0, idx = 0, padsize;
^
>> arch/x86/kernel/callthunks.c:416:5: warning: no previous prototype for function 'setup_padding_thunks' [-Wmissing-prototypes]
int setup_padding_thunks(s32 *start, s32 *end, struct thunk_mem_area *area,
^
arch/x86/kernel/callthunks.c:416:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int setup_padding_thunks(s32 *start, s32 *end, struct thunk_mem_area *area,
^
static
arch/x86/kernel/callthunks.c:547:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!vbuf)
^~~~~
arch/x86/kernel/callthunks.c:613:9: note: uninitialized use occurs here
return ret;
^~~
arch/x86/kernel/callthunks.c:547:3: note: remove the 'if' if its condition is always false
if (!vbuf)
^~~~~~~~~~
arch/x86/kernel/callthunks.c:512:9: note: initialize the variable 'ret' to silence this warning
int ret, text_size, size;
^
= 0
3 warnings generated.
vim +/nthunks +419 arch/x86/kernel/callthunks.c
415
> 416 int setup_padding_thunks(s32 *start, s32 *end, struct thunk_mem_area *area,
417 struct module_layout *layout)
418 {
> 419 int gap, nthunks = 0, idx = 0, padsize;
420 s32 *s;
421
422 padsize = 1 << CONFIG_FUNCTION_PADDING_ORDER;
423 if (callthunk_desc.template_size > padsize)
424 return 0;
425
426 gap = padsize - callthunk_desc.template_size;
427
428 for (s = start; s < end; s++) {
429 void *thunk, *tp, *dest = (void *)s + *s;
430 unsigned long key = (unsigned long)dest;
431 int fail, i;
432 u8 opcode;
433
434 if (is_inittext(layout, dest)) {
435 prdbg("Ignoring init dest: %pS %px\n", dest, dest);
436 continue;
437 }
438
439 /* Multiple symbols can have the same location. */
440 if (btree_lookup64(&call_thunks, key)) {
441 prdbg("Ignoring duplicate dest: %pS %px\n", dest, dest);
442 continue;
443 }
444
445 thunk = tp = dest - 16;
446 prdbg("Probing dest: %pS %px at %px\n", dest, dest, tp);
447 pagefault_disable();
448 fail = 0;
449 for (i = 0; !fail && i < 16; i++) {
450 if (get_kernel_nofault(opcode, tp + i)) {
451 fail = 1;
452 } else if (opcode != 0xcc) {
453 fail = 2;
454 }
455 }
456 pagefault_enable();
457 switch (fail) {
458 case 1:
459 prdbg("Faulted for dest: %pS %px\n", dest, dest);
460 nthunks++;
461 continue;
462 case 2:
463 prdbg("No padding for dest: %pS %px\n", dest, dest);
464 nthunks++;
465 continue;
466 }
467
468 prdbg("Thunk for dest: %pS %px at %px\n", dest, dest, tp);
469 memcpy(tp, callthunk_desc.template, callthunk_desc.template_size);
470 tp += callthunk_desc.template_size;
471
472 switch (gap) {
473 case 0: break;
474 case 1:
475 case 2:
476 case 3:
477 case 4:
478 case 5:
479 case 6:
480 case 7:
481 case 8:
482 memcpy(tp, x86_nops[gap], gap);
483 break;
484 default:
485 __text_gen_insn(tp, JMP32_INSN_OPCODE, tp, dest,
486 JMP32_INSN_SIZE);
487 tp += JMP32_INSN_SIZE;
488 *(u8*)tp = 0xcc;
489 break;
490 }
491
492 if (area->dests) {
493 prdbg("Insert %px at index %d\n", dest, idx);
494 area->dests[idx++] = key;
495 }
496
497 fail = btree_insert64(&call_thunks, key, (void *)thunk, GFP_KERNEL);
498 if (fail)
499 return fail;
500
501 area->nthunks++;
502 }
503 return 0;
504 }
505
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-21 8:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-21 8:59 [ammarfaizi2-block:tglx/devel/depthtracking 45/45] arch/x86/kernel/callthunks.c:419:11: warning: variable 'nthunks' set but not used kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox