[peterz-queue:x86/wip.ibt 42/42] arch/x86/kernel/alternative.c:538:30: warning: passing argument 1 of 'is_endbr' makes integer from pointer without a cast

From: kernel test robot
Date: Wed Feb 23 2022 - 22:43:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/wip.ibt
head: 27b6438f414b6a37b60dcd90c8980397586d49db
commit: 27b6438f414b6a37b60dcd90c8980397586d49db [42/42] x86/alternative: Use .ibt_endbr_sites to seal indirect calls
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220224/202202241157.jQc2OHWz-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=27b6438f414b6a37b60dcd90c8980397586d49db
git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
git fetch --no-tags peterz-queue x86/wip.ibt
git checkout 27b6438f414b6a37b60dcd90c8980397586d49db
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kernel/

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

All warnings (new ones prefixed by >>):

In file included from arch/x86/include/asm/bug.h:86,
from include/linux/bug.h:5,
from include/linux/cpumask.h:14,
from arch/x86/include/asm/cpumask.h:5,
from arch/x86/include/asm/msr.h:11,
from arch/x86/include/asm/processor.h:22,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:65,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from arch/x86/kernel/alternative.c:4:
arch/x86/kernel/alternative.c: In function 'apply_ibt_endbr':
>> arch/x86/kernel/alternative.c:538:30: warning: passing argument 1 of 'is_endbr' makes integer from pointer without a cast [-Wint-conversion]
538 | if (WARN_ON_ONCE(!is_endbr(&endbr)))
| ^~~~~~
| |
| u32 * {aka unsigned int *}
include/asm-generic/bug.h:104:25: note: in definition of macro 'WARN_ON_ONCE'
104 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
In file included from arch/x86/include/asm/linkage.h:6,
from include/linux/linkage.h:8,
from arch/x86/include/asm/cache.h:5,
from include/linux/cache.h:6,
from include/linux/time.h:5,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from arch/x86/kernel/alternative.c:4:
arch/x86/include/asm/ibt.h:34:42: note: expected 'unsigned int' but argument is of type 'u32 *' {aka 'unsigned int *'}
34 | static inline bool is_endbr(unsigned int val)
| ~~~~~~~~~~~~~^~~


vim +/is_endbr +538 arch/x86/kernel/alternative.c

523
524 /*
525 * Generated by: objtool --ibt-seal
526 */
527 void __init_or_module noinline apply_ibt_endbr(s32 *start, s32 *end)
528 {
529 s32 *s;
530
531 for (s = start; s < end; s++) {
532 void *addr = (void *)s + *s;
533 u32 endbr;
534
535 if (WARN_ON_ONCE(get_kernel_nofault(endbr, addr)))
536 continue;
537
> 538 if (WARN_ON_ONCE(!is_endbr(&endbr)))
539 continue;
540
541 DPRINTK("ENDBR at: %pS (%px)", addr, addr);
542
543 /*
544 * When we have IBT, the lack of ENDBR will trigger #CP
545 * When we don't have IBT, explicitly trigger #UD
546 */
547 DUMP_BYTES(((u8*)addr), 4, "%px: orig: ", addr);
548 DUMP_BYTES(((u8*)ud1_endbr), 4, "%px: repl: ", addr);
549 text_poke_early(addr, ud1_endbr, 4);
550 }
551 }
552

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx