Re: [PATCH v2 1/2] riscv: Add STACKPROTECTOR supported

From: kernel test robot
Date: Thu Jul 09 2020 - 14:52:21 EST


Hi,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.8-rc4 next-20200709]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/guoren-kernel-org/riscv-Add-STACKPROTECTOR-supported/20200709-153112
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0bddd227f3dc55975e2b8dfa7fc6f959b062a2c7
config: riscv-randconfig-s031-20200709 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-37-gc9676a3b-dirty
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=riscv

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 include/linux/stackprotector.h:10,
from arch/riscv/kernel/process.c:28:
arch/riscv/include/asm/stackprotector.h: In function 'boot_init_stack_canary':
>> arch/riscv/include/asm/stackprotector.h:26:23: warning: left shift count >= width of type [-Wshift-count-overflow]
26 | canary += tsc + (tsc << 32UL);
| ^~
arch/riscv/kernel/process.c: At top level:
arch/riscv/kernel/process.c:42:6: warning: no previous prototype for 'show_regs' [-Wmissing-prototypes]
42 | void show_regs(struct pt_regs *regs)
| ^~~~~~~~~
arch/riscv/kernel/process.c:103:5: warning: no previous prototype for 'arch_dup_task_struct' [-Wmissing-prototypes]
103 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
| ^~~~~~~~~~~~~~~~~~~~

vim +26 arch/riscv/include/asm/stackprotector.h

11
12 /*
13 * Initialize the stackprotector canary value.
14 *
15 * NOTE: this must only be called from functions that never return,
16 * and it must always be inlined.
17 */
18 static __always_inline void boot_init_stack_canary(void)
19 {
20 unsigned long canary;
21 unsigned long tsc;
22
23 /* Try to get a semi random initial value. */
24 get_random_bytes(&canary, sizeof(canary));
25 tsc = get_cycles();
> 26 canary += tsc + (tsc << 32UL);

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

Attachment: .config.gz
Description: application/gzip