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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 11 Nov 2020 14:32:14 +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: fs/binfmt_flat.c:402:9: sparse: sparse: incorrect type in argument 1
 (different address spaces)

Hi Luc,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   eccc876724927ff3b9ff91f36f7b6b159e948f0c
commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr()
date:   2 months ago
config: sh-randconfig-s031-20201111 (attached as .config)
compiler: sh4-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.3-106-gd020cf33-dirty
        # 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
        # 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=sh 

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 >>)"
   fs/binfmt_flat.c:402:9: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned long const *__gu_addr @@     got unsigned long [noderef] __user *[assigned] ptr @@
   fs/binfmt_flat.c:402:9: sparse:     expected unsigned long const *__gu_addr
   fs/binfmt_flat.c:402:9: sparse:     got unsigned long [noderef] __user *[assigned] ptr
>> fs/binfmt_flat.c:402:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned long const *__gu_addr @@
   fs/binfmt_flat.c:402:9: sparse:     expected void const volatile [noderef] __user *ptr
   fs/binfmt_flat.c:402:9: sparse:     got unsigned long const *__gu_addr
   fs/binfmt_flat.c:775:29: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int const *__gu_addr @@     got unsigned int [noderef] [usertype] __user *[assigned] rp @@
   fs/binfmt_flat.c:775:29: sparse:     expected unsigned int const *__gu_addr
   fs/binfmt_flat.c:775:29: sparse:     got unsigned int [noderef] [usertype] __user *[assigned] rp
   fs/binfmt_flat.c:775:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned int const *__gu_addr @@
   fs/binfmt_flat.c:775:29: sparse:     expected void const volatile [noderef] __user *ptr
   fs/binfmt_flat.c:775:29: sparse:     got unsigned int const *__gu_addr
   fs/binfmt_flat.c:812:29: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected restricted __be32 const *__gu_addr @@     got restricted __be32 [noderef] [usertype] __user * @@
   fs/binfmt_flat.c:812:29: sparse:     expected restricted __be32 const *__gu_addr
   fs/binfmt_flat.c:812:29: sparse:     got restricted __be32 [noderef] [usertype] __user *
   fs/binfmt_flat.c:812:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got restricted __be32 const *__gu_addr @@
   fs/binfmt_flat.c:812:29: sparse:     expected void const volatile [noderef] __user *ptr
   fs/binfmt_flat.c:812:29: sparse:     got restricted __be32 const *__gu_addr
   fs/binfmt_flat.c:855:29: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected restricted __be32 const *__gu_addr @@     got restricted __be32 [noderef] [usertype] __user * @@
   fs/binfmt_flat.c:855:29: sparse:     expected restricted __be32 const *__gu_addr
   fs/binfmt_flat.c:855:29: sparse:     got restricted __be32 [noderef] [usertype] __user *
   fs/binfmt_flat.c:855:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got restricted __be32 const *__gu_addr @@
   fs/binfmt_flat.c:855:29: sparse:     expected void const volatile [noderef] __user *ptr
   fs/binfmt_flat.c:855:29: sparse:     got restricted __be32 const *__gu_addr
   fs/binfmt_flat.c:865:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *__cl_addr @@
   fs/binfmt_flat.c:865:13: sparse:     expected void *addr
   fs/binfmt_flat.c:865:13: sparse:     got void [noderef] __user *__cl_addr
--
>> arch/sh/kernel/cpu/sh3/clock-sh7712.c:23:21: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned int @@
>> arch/sh/kernel/cpu/sh3/clock-sh7712.c:23:21: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/cpu/sh3/clock-sh7712.c:23:21: sparse:     got unsigned int
   arch/sh/kernel/cpu/sh3/clock-sh7712.c:35:21: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned int @@
   arch/sh/kernel/cpu/sh3/clock-sh7712.c:35:21: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/cpu/sh3/clock-sh7712.c:35:21: sparse:     got unsigned int
   arch/sh/kernel/cpu/sh3/clock-sh7712.c:47:21: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned int @@
   arch/sh/kernel/cpu/sh3/clock-sh7712.c:47:21: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/kernel/cpu/sh3/clock-sh7712.c:47:21: sparse:     got unsigned int
--
   drivers/hid/usbhid/hiddev.c:569:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user * @@
   drivers/hid/usbhid/hiddev.c:569:13: sparse:     expected int const *__gu_addr
   drivers/hid/usbhid/hiddev.c:569:13: sparse:     got int [noderef] __user *
>> drivers/hid/usbhid/hiddev.c:569:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   drivers/hid/usbhid/hiddev.c:569:13: sparse:     expected void const volatile [noderef] __user *ptr
   drivers/hid/usbhid/hiddev.c:569:13: sparse:     got int const *__gu_addr
   drivers/hid/usbhid/hiddev.c:664:29: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] __user * @@
   drivers/hid/usbhid/hiddev.c:664:29: sparse:     expected int const *__gu_addr
   drivers/hid/usbhid/hiddev.c:664:29: sparse:     got int [noderef] __user *
   drivers/hid/usbhid/hiddev.c:664:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int const *__gu_addr @@
   drivers/hid/usbhid/hiddev.c:664:29: sparse:     expected void const volatile [noderef] __user *ptr
   drivers/hid/usbhid/hiddev.c:664:29: sparse:     got int const *__gu_addr
--
>> arch/sh/drivers/dma/dma-sh.c:111:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
>> arch/sh/drivers/dma/dma-sh.c:111:16: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:111:16: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:117:9: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:117:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:117:9: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:151:9: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:151:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:151:9: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:162:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:162:16: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:162:16: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:168:9: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:168:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:168:9: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:186:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:186:16: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:186:16: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:188:9: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:188:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:188:9: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:219:17: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:219:17: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:219:17: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:222:17: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:222:17: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:222:17: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:224:9: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:224:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:224:9: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:234:15: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:234:15: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:234:15: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:237:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:237:16: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:237:16: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:93:20: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:93:20: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:93:20: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:93:20: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:93:20: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:93:20: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:262:31: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:262:31: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:262:31: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:266:9: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:266:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:266:9: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:269:9: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:269:9: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:269:9: sparse:     got unsigned long
   arch/sh/drivers/dma/dma-sh.c:272:14: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected void const volatile [noderef] __iomem *ptr @@     got unsigned long @@
   arch/sh/drivers/dma/dma-sh.c:272:14: sparse:     expected void const volatile [noderef] __iomem *ptr
   arch/sh/drivers/dma/dma-sh.c:272:14: sparse:     got unsigned long

vim +402 fs/binfmt_flat.c

^1da177e4c3f415 Linus Torvalds    2005-04-16  387  
cf9a566c2c06ac3 Christoph Hellwig 2019-06-13  388  #ifdef CONFIG_BINFMT_FLAT_OLD
343034357202be3 Axel Lin          2014-06-04  389  static void old_reloc(unsigned long rl)
^1da177e4c3f415 Linus Torvalds    2005-04-16  390  {
13c3f50c914e6a5 Nicolas Pitre     2016-07-24  391  	static const char *segment[] = { "TEXT", "DATA", "BSS", "*UNKNOWN*" };
^1da177e4c3f415 Linus Torvalds    2005-04-16  392  	flat_v2_reloc_t	r;
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  393  	unsigned long __user *ptr;
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  394  	unsigned long val;
^1da177e4c3f415 Linus Torvalds    2005-04-16  395  
^1da177e4c3f415 Linus Torvalds    2005-04-16  396  	r.value = rl;
^1da177e4c3f415 Linus Torvalds    2005-04-16  397  #if defined(CONFIG_COLDFIRE)
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  398  	ptr = (unsigned long __user *)(current->mm->start_code + r.reloc.offset);
^1da177e4c3f415 Linus Torvalds    2005-04-16  399  #else
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  400  	ptr = (unsigned long __user *)(current->mm->start_data + r.reloc.offset);
^1da177e4c3f415 Linus Torvalds    2005-04-16  401  #endif
1b2ce442ea96b1e Nicolas Pitre     2016-07-24 @402  	get_user(val, ptr);
^1da177e4c3f415 Linus Torvalds    2005-04-16  403  
4adbb6ac4b807e2 Nicolas Pitre     2016-07-24  404  	pr_debug("Relocation of variable at DATASEG+%x "
13c3f50c914e6a5 Nicolas Pitre     2016-07-24  405  		 "(address %p, currently %lx) into segment %s\n",
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  406  		 r.reloc.offset, ptr, val, segment[r.reloc.type]);
^1da177e4c3f415 Linus Torvalds    2005-04-16  407  
^1da177e4c3f415 Linus Torvalds    2005-04-16  408  	switch (r.reloc.type) {
^1da177e4c3f415 Linus Torvalds    2005-04-16  409  	case OLD_FLAT_RELOC_TYPE_TEXT:
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  410  		val += current->mm->start_code;
^1da177e4c3f415 Linus Torvalds    2005-04-16  411  		break;
^1da177e4c3f415 Linus Torvalds    2005-04-16  412  	case OLD_FLAT_RELOC_TYPE_DATA:
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  413  		val += current->mm->start_data;
^1da177e4c3f415 Linus Torvalds    2005-04-16  414  		break;
^1da177e4c3f415 Linus Torvalds    2005-04-16  415  	case OLD_FLAT_RELOC_TYPE_BSS:
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  416  		val += current->mm->end_data;
^1da177e4c3f415 Linus Torvalds    2005-04-16  417  		break;
^1da177e4c3f415 Linus Torvalds    2005-04-16  418  	default:
4adbb6ac4b807e2 Nicolas Pitre     2016-07-24  419  		pr_err("Unknown relocation type=%x\n", r.reloc.type);
^1da177e4c3f415 Linus Torvalds    2005-04-16  420  		break;
^1da177e4c3f415 Linus Torvalds    2005-04-16  421  	}
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  422  	put_user(val, ptr);
^1da177e4c3f415 Linus Torvalds    2005-04-16  423  
1b2ce442ea96b1e Nicolas Pitre     2016-07-24  424  	pr_debug("Relocation became %lx\n", val);
^1da177e4c3f415 Linus Torvalds    2005-04-16  425  }
cf9a566c2c06ac3 Christoph Hellwig 2019-06-13  426  #endif /* CONFIG_BINFMT_FLAT_OLD */
^1da177e4c3f415 Linus Torvalds    2005-04-16  427  

:::::: The code at line 402 was first introduced by commit
:::::: 1b2ce442ea96b1e76300553963154d68cc5b4ad0 binfmt_flat: use proper user space accessors with old relocs code

:::::: TO: Nicolas Pitre <nicolas.pitre@...aro.org>
:::::: CC: Greg Ungerer <gerg@...ux-m68k.org>

---
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" (22761 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ