[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202202130419.oJqXwirc-lkp@intel.com>
Date: Sun, 13 Feb 2022 04:19:41 +0800
From: kernel test robot <lkp@...el.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [arnd-playground:set_fs 6/11]
arch/riscv/kernel/perf_callchain.c:22:14: sparse: sparse: incorrect type in
argument 1 (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git set_fs
head: 0a081326831928b0d739bce68b8c0f9138b9c8ba
commit: a954036380ae20dbfa0c203bf6cafb21d1f3cedd [6/11] uaccess: generalize access_ok()
config: riscv-randconfig-s032-20220213 (https://download.01.org/0day-ci/archive/20220213/202202130419.oJqXwirc-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 11.2.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.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=a954036380ae20dbfa0c203bf6cafb21d1f3cedd
git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
git fetch --no-tags arnd-playground set_fs
git checkout a954036380ae20dbfa0c203bf6cafb21d1f3cedd
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/kernel/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> arch/riscv/kernel/perf_callchain.c:22:14: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __user *ptr @@ got unsigned long *user_frame_tail @@
arch/riscv/kernel/perf_callchain.c:22:14: sparse: expected void const [noderef] __user *ptr
arch/riscv/kernel/perf_callchain.c:22:14: sparse: got unsigned long *user_frame_tail
arch/riscv/kernel/perf_callchain.c:24:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got unsigned long *user_frame_tail @@
arch/riscv/kernel/perf_callchain.c:24:49: sparse: expected void const [noderef] __user *from
arch/riscv/kernel/perf_callchain.c:24:49: sparse: got unsigned long *user_frame_tail
vim +22 arch/riscv/kernel/perf_callchain.c
dbeb90b0c1eb86 Mao Han 2019-08-29 8
dbeb90b0c1eb86 Mao Han 2019-08-29 9 /*
dbeb90b0c1eb86 Mao Han 2019-08-29 10 * Get the return address for a single stackframe and return a pointer to the
dbeb90b0c1eb86 Mao Han 2019-08-29 11 * next frame tail.
dbeb90b0c1eb86 Mao Han 2019-08-29 12 */
dbeb90b0c1eb86 Mao Han 2019-08-29 13 static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry,
dbeb90b0c1eb86 Mao Han 2019-08-29 14 unsigned long fp, unsigned long reg_ra)
dbeb90b0c1eb86 Mao Han 2019-08-29 15 {
dbeb90b0c1eb86 Mao Han 2019-08-29 16 struct stackframe buftail;
dbeb90b0c1eb86 Mao Han 2019-08-29 17 unsigned long ra = 0;
dbeb90b0c1eb86 Mao Han 2019-08-29 18 unsigned long *user_frame_tail =
dbeb90b0c1eb86 Mao Han 2019-08-29 19 (unsigned long *)(fp - sizeof(struct stackframe));
dbeb90b0c1eb86 Mao Han 2019-08-29 20
dbeb90b0c1eb86 Mao Han 2019-08-29 21 /* Check accessibility of one struct frame_tail beyond */
dbeb90b0c1eb86 Mao Han 2019-08-29 @22 if (!access_ok(user_frame_tail, sizeof(buftail)))
dbeb90b0c1eb86 Mao Han 2019-08-29 23 return 0;
dbeb90b0c1eb86 Mao Han 2019-08-29 24 if (__copy_from_user_inatomic(&buftail, user_frame_tail,
dbeb90b0c1eb86 Mao Han 2019-08-29 25 sizeof(buftail)))
dbeb90b0c1eb86 Mao Han 2019-08-29 26 return 0;
dbeb90b0c1eb86 Mao Han 2019-08-29 27
dbeb90b0c1eb86 Mao Han 2019-08-29 28 if (reg_ra != 0)
dbeb90b0c1eb86 Mao Han 2019-08-29 29 ra = reg_ra;
dbeb90b0c1eb86 Mao Han 2019-08-29 30 else
dbeb90b0c1eb86 Mao Han 2019-08-29 31 ra = buftail.ra;
dbeb90b0c1eb86 Mao Han 2019-08-29 32
dbeb90b0c1eb86 Mao Han 2019-08-29 33 fp = buftail.fp;
dbeb90b0c1eb86 Mao Han 2019-08-29 34 if (ra != 0)
dbeb90b0c1eb86 Mao Han 2019-08-29 35 perf_callchain_store(entry, ra);
dbeb90b0c1eb86 Mao Han 2019-08-29 36 else
dbeb90b0c1eb86 Mao Han 2019-08-29 37 return 0;
dbeb90b0c1eb86 Mao Han 2019-08-29 38
dbeb90b0c1eb86 Mao Han 2019-08-29 39 return fp;
dbeb90b0c1eb86 Mao Han 2019-08-29 40 }
dbeb90b0c1eb86 Mao Han 2019-08-29 41
:::::: The code at line 22 was first introduced by commit
:::::: dbeb90b0c1eb86a9b963b929d3c937afb7dadfa3 riscv: Add perf callchain support
:::::: TO: Mao Han <han_mao@...ky.com>
:::::: CC: Paul Walmsley <paul.walmsley@...ive.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists