CC: [email protected]
CC: [email protected]
TO: Peter Zijlstra <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git 
objtool/core
head:   c59205d0022488e4625ffbcf7c87095dca05fa6d
commit: ad68a08875a6f809f833c958ff034df214973562 [30/39] x86/alternative: 
Implement .retpoline_sites support
:::::: branch date: 11 hours ago
:::::: commit date: 11 hours ago
config: x86_64-randconfig-s031-20211013 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=ad68a08875a6f809f833c958ff034df214973562
        git remote add peterz-queue 
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
        git fetch --no-tags peterz-queue objtool/core
        git checkout ad68a08875a6f809f833c958ff034df214973562
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' 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 <[email protected]>


sparse warnings: (new ones prefixed by >>)
>> arch/x86/kernel/alternative.c:399:23: sparse: sparse: subtraction of 
>> functions? Share your drugs
   arch/x86/kernel/alternative.c:400:42: sparse: sparse: subtraction of 
functions? Share your drugs

vim +399 arch/x86/kernel/alternative.c

ad68a08875a6f8 Peter Zijlstra 2021-10-12  377  
ad68a08875a6f8 Peter Zijlstra 2021-10-12  378  /*
ad68a08875a6f8 Peter Zijlstra 2021-10-12  379   * Rewrite the compiler 
generated retpoline thunk calls.
ad68a08875a6f8 Peter Zijlstra 2021-10-12  380   *
ad68a08875a6f8 Peter Zijlstra 2021-10-12  381   * For spectre_v2=off 
(!X86_FEATURE_RETPOLINE), rewrite them into immediate
ad68a08875a6f8 Peter Zijlstra 2021-10-12  382   * indirect instructions, 
avoiding the extra indirection.
ad68a08875a6f8 Peter Zijlstra 2021-10-12  383   *
ad68a08875a6f8 Peter Zijlstra 2021-10-12  384   * For example, convert:
ad68a08875a6f8 Peter Zijlstra 2021-10-12  385   *
ad68a08875a6f8 Peter Zijlstra 2021-10-12  386   *   CALL 
__x86_indirect_thunk_\reg
ad68a08875a6f8 Peter Zijlstra 2021-10-12  387   *
ad68a08875a6f8 Peter Zijlstra 2021-10-12  388   * into:
ad68a08875a6f8 Peter Zijlstra 2021-10-12  389   *
ad68a08875a6f8 Peter Zijlstra 2021-10-12  390   *   CALL *%\reg
ad68a08875a6f8 Peter Zijlstra 2021-10-12  391   *
ad68a08875a6f8 Peter Zijlstra 2021-10-12  392   */
ad68a08875a6f8 Peter Zijlstra 2021-10-12  393  static int patch_retpoline(void 
*addr, struct insn *insn, u8 *bytes)
ad68a08875a6f8 Peter Zijlstra 2021-10-12  394  {
ad68a08875a6f8 Peter Zijlstra 2021-10-12  395   void (*target)(void);
ad68a08875a6f8 Peter Zijlstra 2021-10-12  396   int reg, i = 0;
ad68a08875a6f8 Peter Zijlstra 2021-10-12  397  
ad68a08875a6f8 Peter Zijlstra 2021-10-12  398   target = addr + insn->length + 
insn->immediate.value;
ad68a08875a6f8 Peter Zijlstra 2021-10-12 @399   reg = (target - 
&__x86_indirect_thunk_rax) /
ad68a08875a6f8 Peter Zijlstra 2021-10-12  400         
(&__x86_indirect_thunk_rcx - &__x86_indirect_thunk_rax);
ad68a08875a6f8 Peter Zijlstra 2021-10-12  401  
ad68a08875a6f8 Peter Zijlstra 2021-10-12  402   if (WARN_ON_ONCE(reg & ~0xf))
ad68a08875a6f8 Peter Zijlstra 2021-10-12  403           return -1;
ad68a08875a6f8 Peter Zijlstra 2021-10-12  404  
ad68a08875a6f8 Peter Zijlstra 2021-10-12  405   /*
ad68a08875a6f8 Peter Zijlstra 2021-10-12  406    * If anyone ever does: 
CALL/JMP *%rsp, we're in deep trouble.
ad68a08875a6f8 Peter Zijlstra 2021-10-12  407    */
ad68a08875a6f8 Peter Zijlstra 2021-10-12  408   BUG_ON(reg == 4);
ad68a08875a6f8 Peter Zijlstra 2021-10-12  409  
ad68a08875a6f8 Peter Zijlstra 2021-10-12  410   if 
(cpu_feature_enabled(X86_FEATURE_RETPOLINE))
ad68a08875a6f8 Peter Zijlstra 2021-10-12  411           return -1;
ad68a08875a6f8 Peter Zijlstra 2021-10-12  412  
ad68a08875a6f8 Peter Zijlstra 2021-10-12  413   i = 
emit_indirect(insn->opcode.bytes[0], reg, bytes);
ad68a08875a6f8 Peter Zijlstra 2021-10-12  414   if (i < 0)
ad68a08875a6f8 Peter Zijlstra 2021-10-12  415           return i;
ad68a08875a6f8 Peter Zijlstra 2021-10-12  416  
ad68a08875a6f8 Peter Zijlstra 2021-10-12  417   for (; i < insn->length;)
ad68a08875a6f8 Peter Zijlstra 2021-10-12  418           bytes[i++] = BYTES_NOP1;
ad68a08875a6f8 Peter Zijlstra 2021-10-12  419  
ad68a08875a6f8 Peter Zijlstra 2021-10-12  420   return i;
ad68a08875a6f8 Peter Zijlstra 2021-10-12  421  }
ad68a08875a6f8 Peter Zijlstra 2021-10-12  422  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to