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]
Message-ID: <202105180758.9Mepczfm-lkp@intel.com>
Date:   Tue, 18 May 2021 07:05:04 +0800
From:   kernel test robot <lkp@...el.com>
To:     Guo Ren <guoren@...ux.alibaba.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: arch/csky/abiv2/fpu.c:32:17: 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:   d07f6ca923ea0927a1024dfccafc5b53b61cfecc
commit: e58a41c2226847fb1446f3942dc1b55af8acfe02 csky: uaccess.h: Coding convention with asm generic
date:   3 weeks ago
config: csky-randconfig-s032-20210518 (attached as .config)
compiler: csky-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-341-g8af24329-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e58a41c2226847fb1446f3942dc1b55af8acfe02
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e58a41c2226847fb1446f3942dc1b55af8acfe02
        # 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__' W=1 ARCH=csky 

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/csky/abiv2/fpu.c:32:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:32:17: sparse:     expected void const volatile [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:32:17: sparse:     got unsigned short [usertype] *
>> arch/csky/abiv2/fpu.c:32:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:32:17: sparse:     expected void const [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:32:17: sparse:     got unsigned short [usertype] *
>> arch/csky/abiv2/fpu.c:32:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:32:17: sparse:     expected void const [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:32:17: sparse:     got unsigned short [usertype] *
>> arch/csky/abiv2/fpu.c:32:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:32:17: sparse:     expected void const [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:32:17: sparse:     got unsigned short [usertype] *
>> arch/csky/abiv2/fpu.c:32:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:32:17: sparse:     expected void const [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:32:17: sparse:     got unsigned short [usertype] *
   arch/csky/abiv2/fpu.c:36:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:36:17: sparse:     expected void const volatile [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:36:17: sparse:     got unsigned short [usertype] *
   arch/csky/abiv2/fpu.c:36:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:36:17: sparse:     expected void const [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:36:17: sparse:     got unsigned short [usertype] *
   arch/csky/abiv2/fpu.c:36:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:36:17: sparse:     expected void const [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:36:17: sparse:     got unsigned short [usertype] *
   arch/csky/abiv2/fpu.c:36:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:36:17: sparse:     expected void const [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:36:17: sparse:     got unsigned short [usertype] *
   arch/csky/abiv2/fpu.c:36:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned short [usertype] * @@
   arch/csky/abiv2/fpu.c:36:17: sparse:     expected void const [noderef] __user *ptr
   arch/csky/abiv2/fpu.c:36:17: sparse:     got unsigned short [usertype] *

vim +32 arch/csky/abiv2/fpu.c

e9564df753fd54 Guo Ren 2018-09-05  12  
e9564df753fd54 Guo Ren 2018-09-05  13  /*
e9564df753fd54 Guo Ren 2018-09-05  14   * fpu_libc_helper() is to help libc to excute:
e9564df753fd54 Guo Ren 2018-09-05  15   *  - mfcr %a, cr<1, 2>
e9564df753fd54 Guo Ren 2018-09-05  16   *  - mfcr %a, cr<2, 2>
e9564df753fd54 Guo Ren 2018-09-05  17   *  - mtcr %a, cr<1, 2>
e9564df753fd54 Guo Ren 2018-09-05  18   *  - mtcr %a, cr<2, 2>
e9564df753fd54 Guo Ren 2018-09-05  19   */
e9564df753fd54 Guo Ren 2018-09-05  20  int fpu_libc_helper(struct pt_regs *regs)
e9564df753fd54 Guo Ren 2018-09-05  21  {
e9564df753fd54 Guo Ren 2018-09-05  22  	int fault;
e9564df753fd54 Guo Ren 2018-09-05  23  	unsigned long instrptr, regx = 0;
e9564df753fd54 Guo Ren 2018-09-05  24  	unsigned long index = 0, tmp = 0;
e9564df753fd54 Guo Ren 2018-09-05  25  	unsigned long tinstr = 0;
e9564df753fd54 Guo Ren 2018-09-05  26  	u16 instr_hi, instr_low;
e9564df753fd54 Guo Ren 2018-09-05  27  
e9564df753fd54 Guo Ren 2018-09-05  28  	instrptr = instruction_pointer(regs);
e9564df753fd54 Guo Ren 2018-09-05  29  	if (instrptr & 1)
e9564df753fd54 Guo Ren 2018-09-05  30  		return 0;
e9564df753fd54 Guo Ren 2018-09-05  31  
e9564df753fd54 Guo Ren 2018-09-05 @32  	fault = __get_user(instr_low, (u16 *)instrptr);
e9564df753fd54 Guo Ren 2018-09-05  33  	if (fault)
e9564df753fd54 Guo Ren 2018-09-05  34  		return 0;
e9564df753fd54 Guo Ren 2018-09-05  35  
e9564df753fd54 Guo Ren 2018-09-05  36  	fault = __get_user(instr_hi, (u16 *)(instrptr + 2));
e9564df753fd54 Guo Ren 2018-09-05  37  	if (fault)
e9564df753fd54 Guo Ren 2018-09-05  38  		return 0;
e9564df753fd54 Guo Ren 2018-09-05  39  
e9564df753fd54 Guo Ren 2018-09-05  40  	tinstr = instr_hi | ((unsigned long)instr_low << 16);
e9564df753fd54 Guo Ren 2018-09-05  41  
e9564df753fd54 Guo Ren 2018-09-05  42  	if (((tinstr >> 21) & 0x1F) != 2)
e9564df753fd54 Guo Ren 2018-09-05  43  		return 0;
e9564df753fd54 Guo Ren 2018-09-05  44  
e9564df753fd54 Guo Ren 2018-09-05  45  	if ((tinstr & MTCR_MASK) == MTCR_DIST) {
e9564df753fd54 Guo Ren 2018-09-05  46  		index = (tinstr >> 16) & 0x1F;
e9564df753fd54 Guo Ren 2018-09-05  47  		if (index > 13)
e9564df753fd54 Guo Ren 2018-09-05  48  			return 0;
e9564df753fd54 Guo Ren 2018-09-05  49  
e9564df753fd54 Guo Ren 2018-09-05  50  		tmp = tinstr & 0x1F;
e9564df753fd54 Guo Ren 2018-09-05  51  		if (tmp > 2)
e9564df753fd54 Guo Ren 2018-09-05  52  			return 0;
e9564df753fd54 Guo Ren 2018-09-05  53  
e9564df753fd54 Guo Ren 2018-09-05  54  		regx =  *(&regs->a0 + index);
e9564df753fd54 Guo Ren 2018-09-05  55  
e9564df753fd54 Guo Ren 2018-09-05  56  		if (tmp == 1)
e9564df753fd54 Guo Ren 2018-09-05  57  			mtcr("cr<1, 2>", regx);
e9564df753fd54 Guo Ren 2018-09-05  58  		else if (tmp == 2)
e9564df753fd54 Guo Ren 2018-09-05  59  			mtcr("cr<2, 2>", regx);
e9564df753fd54 Guo Ren 2018-09-05  60  		else
e9564df753fd54 Guo Ren 2018-09-05  61  			return 0;
e9564df753fd54 Guo Ren 2018-09-05  62  
e9564df753fd54 Guo Ren 2018-09-05  63  		regs->pc += 4;
e9564df753fd54 Guo Ren 2018-09-05  64  		return 1;
e9564df753fd54 Guo Ren 2018-09-05  65  	}
e9564df753fd54 Guo Ren 2018-09-05  66  
e9564df753fd54 Guo Ren 2018-09-05  67  	if ((tinstr & MFCR_MASK) == MFCR_DIST) {
e9564df753fd54 Guo Ren 2018-09-05  68  		index = tinstr & 0x1F;
e9564df753fd54 Guo Ren 2018-09-05  69  		if (index > 13)
e9564df753fd54 Guo Ren 2018-09-05  70  			return 0;
e9564df753fd54 Guo Ren 2018-09-05  71  
e9564df753fd54 Guo Ren 2018-09-05  72  		tmp = ((tinstr >> 16) & 0x1F);
e9564df753fd54 Guo Ren 2018-09-05  73  		if (tmp > 2)
e9564df753fd54 Guo Ren 2018-09-05  74  			return 0;
e9564df753fd54 Guo Ren 2018-09-05  75  
e9564df753fd54 Guo Ren 2018-09-05  76  		if (tmp == 1)
e9564df753fd54 Guo Ren 2018-09-05  77  			regx = mfcr("cr<1, 2>");
e9564df753fd54 Guo Ren 2018-09-05  78  		else if (tmp == 2)
e9564df753fd54 Guo Ren 2018-09-05  79  			regx = mfcr("cr<2, 2>");
e9564df753fd54 Guo Ren 2018-09-05  80  		else
e9564df753fd54 Guo Ren 2018-09-05  81  			return 0;
e9564df753fd54 Guo Ren 2018-09-05  82  
e9564df753fd54 Guo Ren 2018-09-05  83  		*(&regs->a0 + index) = regx;
e9564df753fd54 Guo Ren 2018-09-05  84  
e9564df753fd54 Guo Ren 2018-09-05  85  		regs->pc += 4;
e9564df753fd54 Guo Ren 2018-09-05  86  		return 1;
e9564df753fd54 Guo Ren 2018-09-05  87  	}
e9564df753fd54 Guo Ren 2018-09-05  88  
e9564df753fd54 Guo Ren 2018-09-05  89  	return 0;
e9564df753fd54 Guo Ren 2018-09-05  90  }
e9564df753fd54 Guo Ren 2018-09-05  91  

:::::: The code at line 32 was first introduced by commit
:::::: e9564df753fd547fcbcd4fd10015c3b1213ef452 csky: Process management and Signal

:::::: TO: Guo Ren <ren_guo@...ky.com>
:::::: CC: Guo Ren <ren_guo@...ky.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" (32106 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ