lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Tue, 15 Sep 2020 08:33:49 +0800
From:   kernel test robot <lkp@...el.com>
To:     Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Subject: arch/riscv/kernel/perf_callchain.c:26:14: sparse: sparse: incorrect
 type in argument 1 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   856deb866d16e29bd65952e0289066f6078af773
commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr()
date:   2 weeks ago
config: riscv-randconfig-s032-20200915 (attached as .config)
compiler: riscv64-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-191-g10164920-dirty
        git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959
        # 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@...el.com>


sparse warnings: (new ones prefixed by >>)

>> arch/riscv/kernel/perf_callchain.c:26:14: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned long *user_frame_tail @@
>> arch/riscv/kernel/perf_callchain.c:26:14: sparse:     expected void const volatile [noderef] __user *ptr
   arch/riscv/kernel/perf_callchain.c:26:14: sparse:     got unsigned long *user_frame_tail
   arch/riscv/kernel/perf_callchain.c:28: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:28:49: sparse:     expected void const [noderef] __user *from
   arch/riscv/kernel/perf_callchain.c:28:49: sparse:     got unsigned long *user_frame_tail
   arch/riscv/kernel/perf_callchain.c:77:6: sparse: sparse: symbol 'fill_callchain' was not declared. Should it be static?

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5fc436f06eef54ef512ea55a9db8eb9f2e76959
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959
vim +26 arch/riscv/kernel/perf_callchain.c

dbeb90b0c1eb86 Mao Han 2019-08-29  12  
dbeb90b0c1eb86 Mao Han 2019-08-29  13  /*
dbeb90b0c1eb86 Mao Han 2019-08-29  14   * Get the return address for a single stackframe and return a pointer to the
dbeb90b0c1eb86 Mao Han 2019-08-29  15   * next frame tail.
dbeb90b0c1eb86 Mao Han 2019-08-29  16   */
dbeb90b0c1eb86 Mao Han 2019-08-29  17  static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry,
dbeb90b0c1eb86 Mao Han 2019-08-29  18  				    unsigned long fp, unsigned long reg_ra)
dbeb90b0c1eb86 Mao Han 2019-08-29  19  {
dbeb90b0c1eb86 Mao Han 2019-08-29  20  	struct stackframe buftail;
dbeb90b0c1eb86 Mao Han 2019-08-29  21  	unsigned long ra = 0;
dbeb90b0c1eb86 Mao Han 2019-08-29  22  	unsigned long *user_frame_tail =
dbeb90b0c1eb86 Mao Han 2019-08-29  23  			(unsigned long *)(fp - sizeof(struct stackframe));
dbeb90b0c1eb86 Mao Han 2019-08-29  24  
dbeb90b0c1eb86 Mao Han 2019-08-29  25  	/* Check accessibility of one struct frame_tail beyond */
dbeb90b0c1eb86 Mao Han 2019-08-29 @26  	if (!access_ok(user_frame_tail, sizeof(buftail)))
dbeb90b0c1eb86 Mao Han 2019-08-29  27  		return 0;
dbeb90b0c1eb86 Mao Han 2019-08-29  28  	if (__copy_from_user_inatomic(&buftail, user_frame_tail,
dbeb90b0c1eb86 Mao Han 2019-08-29  29  				      sizeof(buftail)))
dbeb90b0c1eb86 Mao Han 2019-08-29  30  		return 0;
dbeb90b0c1eb86 Mao Han 2019-08-29  31  
dbeb90b0c1eb86 Mao Han 2019-08-29  32  	if (reg_ra != 0)
dbeb90b0c1eb86 Mao Han 2019-08-29  33  		ra = reg_ra;
dbeb90b0c1eb86 Mao Han 2019-08-29  34  	else
dbeb90b0c1eb86 Mao Han 2019-08-29  35  		ra = buftail.ra;
dbeb90b0c1eb86 Mao Han 2019-08-29  36  
dbeb90b0c1eb86 Mao Han 2019-08-29  37  	fp = buftail.fp;
dbeb90b0c1eb86 Mao Han 2019-08-29  38  	if (ra != 0)
dbeb90b0c1eb86 Mao Han 2019-08-29  39  		perf_callchain_store(entry, ra);
dbeb90b0c1eb86 Mao Han 2019-08-29  40  	else
dbeb90b0c1eb86 Mao Han 2019-08-29  41  		return 0;
dbeb90b0c1eb86 Mao Han 2019-08-29  42  
dbeb90b0c1eb86 Mao Han 2019-08-29  43  	return fp;
dbeb90b0c1eb86 Mao Han 2019-08-29  44  }
dbeb90b0c1eb86 Mao Han 2019-08-29  45  

:::::: The code at line 26 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

Download attachment ".config.gz" of type "application/gzip" (30544 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ