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]
Message-ID: <202210241207.PFYjX7L8-lkp@intel.com>
Date:   Mon, 24 Oct 2022 12:44:42 +0800
From:   kernel test robot <lkp@...el.com>
To:     "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [kas:lam 5/18] kernel/bpf/bpf_iter.c:481:29: sparse: sparse:
 incorrect type in assignment (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git lam
head:   01819ca3dcb30fc9114025c8c5da8bcee0cabcee
commit: bb9d0488e7c6bfff85581168d4f49f48cd11ac36 [5/18] x86/uaccess: Provide untagged_addr() and remove tags before address check
config: x86_64-randconfig-s023
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git/commit/?id=bb9d0488e7c6bfff85581168d4f49f48cd11ac36
        git remote add kas https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git
        git fetch --no-tags kas lam
        git checkout bb9d0488e7c6bfff85581168d4f49f48cd11ac36
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/bpf/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

sparse warnings: (new ones prefixed by >>)
>> kernel/bpf/bpf_iter.c:481:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *__ptr_clean @@     got char * @@
   kernel/bpf/bpf_iter.c:481:29: sparse:     expected char [noderef] __user *__ptr_clean
   kernel/bpf/bpf_iter.c:481:29: sparse:     got char *
--
   kernel/bpf/hashtab.c:1023:30: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void [noderef] __percpu *[assigned] pptr @@     got void * @@
   kernel/bpf/hashtab.c:1023:30: sparse:     expected void [noderef] __percpu *[assigned] pptr
   kernel/bpf/hashtab.c:1023:30: sparse:     got void *
   kernel/bpf/hashtab.c:1029:44: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *ptr_to_pptr @@     got void [noderef] __percpu *[assigned] pptr @@
   kernel/bpf/hashtab.c:1029:44: sparse:     expected void *ptr_to_pptr
   kernel/bpf/hashtab.c:1029:44: sparse:     got void [noderef] __percpu *[assigned] pptr
   kernel/bpf/hashtab.c:1030:34: sparse: sparse: cast removes address space '__percpu' of expression
   kernel/bpf/hashtab.c:1030:30: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void [noderef] __percpu *[assigned] pptr @@     got void * @@
   kernel/bpf/hashtab.c:1030:30: sparse:     expected void [noderef] __percpu *[assigned] pptr
   kernel/bpf/hashtab.c:1030:30: sparse:     got void *
>> kernel/bpf/hashtab.c:1689:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/hashtab.c:1689:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/hashtab.c:1689:13: sparse:     got unsigned int *
   kernel/bpf/hashtab.c:1870:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/hashtab.c:1870:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/hashtab.c:1870:13: sparse:     got unsigned int *
   kernel/bpf/hashtab.c:801:27: sparse: sparse: context imbalance in 'htab_lru_map_delete_node' - unexpected unlock
   kernel/bpf/hashtab.c:1160:27: sparse: sparse: context imbalance in 'htab_map_update_elem' - unexpected unlock
   kernel/bpf/hashtab.c:1227:27: sparse: sparse: context imbalance in 'htab_lru_map_update_elem' - unexpected unlock
   kernel/bpf/hashtab.c:1288:27: sparse: sparse: context imbalance in '__htab_percpu_map_update_elem' - unexpected unlock
   kernel/bpf/hashtab.c:1353:27: sparse: sparse: context imbalance in '__htab_lru_percpu_map_update_elem' - unexpected unlock
   kernel/bpf/hashtab.c:1405:27: sparse: sparse: context imbalance in 'htab_map_delete_elem' - unexpected unlock
   kernel/bpf/hashtab.c:1439:27: sparse: sparse: context imbalance in 'htab_lru_map_delete_elem' - unexpected unlock
   kernel/bpf/hashtab.c:1614:27: sparse: sparse: context imbalance in '__htab_map_lookup_and_delete_elem' - unexpected unlock
   kernel/bpf/hashtab.c:1750:17: sparse: sparse: context imbalance in '__htab_map_lookup_and_delete_batch' - unexpected unlock
   kernel/bpf/hashtab.c:1983:17: sparse: sparse: context imbalance in 'bpf_hash_map_seq_find_next' - unexpected unlock
   kernel/bpf/hashtab.c: note: in included file (through include/linux/workqueue.h, include/linux/bpf.h):
   include/linux/rcupdate.h:769:9: sparse: sparse: context imbalance in 'bpf_hash_map_seq_stop' - unexpected unlock
--
>> kernel/bpf/syscall.c:1700:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:1700:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:1700:13: sparse:     got unsigned int *
>> kernel/bpf/syscall.c:3189:21: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *__ptr_clean @@     got char * @@
   kernel/bpf/syscall.c:3189:21: sparse:     expected char [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:3189:21: sparse:     got char *
   kernel/bpf/syscall.c:3659:23: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:3659:23: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:3659:23: sparse:     got unsigned int *
   kernel/bpf/syscall.c:3935:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:3935:29: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:3935:29: sparse:     got unsigned int *
>> kernel/bpf/syscall.c:4058:45: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned long long [noderef] __user *__ptr_clean @@     got unsigned long long * @@
   kernel/bpf/syscall.c:4058:45: sparse:     expected unsigned long long [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4058:45: sparse:     got unsigned long long *
   kernel/bpf/syscall.c:4064:37: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned long long [noderef] __user *__ptr_clean @@     got unsigned long long * @@
   kernel/bpf/syscall.c:4064:37: sparse:     expected unsigned long long [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4064:37: sparse:     got unsigned long long *
   kernel/bpf/syscall.c:4086:45: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:4086:45: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4086:45: sparse:     got unsigned int *
   kernel/bpf/syscall.c:4091:37: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:4091:37: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4091:37: sparse:     got unsigned int *
   kernel/bpf/syscall.c:4144:37: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned long long [noderef] __user *__ptr_clean @@     got unsigned long long * @@
   kernel/bpf/syscall.c:4144:37: sparse:     expected unsigned long long [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4144:37: sparse:     got unsigned long long *
   kernel/bpf/syscall.c:4176:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:4176:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4176:13: sparse:     got unsigned int *
   kernel/bpf/syscall.c:4221:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:4221:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4221:13: sparse:     got unsigned int *
   kernel/bpf/syscall.c:4273:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:4273:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4273:13: sparse:     got unsigned int *
   kernel/bpf/syscall.c:4350:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:4350:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4350:13: sparse:     got unsigned int *
   kernel/bpf/syscall.c:4358:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *__ptr_clean @@     got char * @@
   kernel/bpf/syscall.c:4358:29: sparse:     expected char [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4358:29: sparse:     got char *
   kernel/bpf/syscall.c:4373:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *__ptr_clean @@     got char * @@
   kernel/bpf/syscall.c:4373:29: sparse:     expected char [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4373:29: sparse:     got char *
   kernel/bpf/syscall.c:4378:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:4378:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4378:13: sparse:     got unsigned int *
   kernel/bpf/syscall.c:4379:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/syscall.c:4379:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4379:13: sparse:     got unsigned int *
   kernel/bpf/syscall.c:4380:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned long long [noderef] __user *__ptr_clean @@     got unsigned long long * @@
   kernel/bpf/syscall.c:4380:13: sparse:     expected unsigned long long [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4380:13: sparse:     got unsigned long long *
   kernel/bpf/syscall.c:4381:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned long long [noderef] __user *__ptr_clean @@     got unsigned long long * @@
   kernel/bpf/syscall.c:4381:13: sparse:     expected unsigned long long [noderef] __user *__ptr_clean
   kernel/bpf/syscall.c:4381:13: sparse:     got unsigned long long *
--
>> kernel/bpf/btf.c:6986:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *__ptr_clean @@     got char * @@
   kernel/bpf/btf.c:6986:29: sparse:     expected char [noderef] __user *__ptr_clean
   kernel/bpf/btf.c:6986:29: sparse:     got char *
>> kernel/bpf/btf.c:6994:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned int [noderef] __user *__ptr_clean @@     got unsigned int * @@
   kernel/bpf/btf.c:6994:13: sparse:     expected unsigned int [noderef] __user *__ptr_clean
   kernel/bpf/btf.c:6994:13: sparse:     got unsigned int *
--
>> kernel/bpf/verifier.c:327:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected char [noderef] __user *__ptr_clean @@     got char * @@
   kernel/bpf/verifier.c:327:13: sparse:     expected char [noderef] __user *__ptr_clean
   kernel/bpf/verifier.c:327:13: sparse:     got char *
   kernel/bpf/verifier.c:14388:38: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c: note: in included file (through include/linux/bpf.h, include/linux/bpf-cgroup.h):
   include/linux/bpfptr.h:65:40: sparse: sparse: cast to non-scalar
   include/linux/bpfptr.h:65:40: sparse: sparse: cast from non-scalar
   include/linux/bpfptr.h:65:40: sparse: sparse: cast to non-scalar
   include/linux/bpfptr.h:65:40: sparse: sparse: cast from non-scalar
   include/linux/bpfptr.h:65:40: sparse: sparse: cast to non-scalar
   include/linux/bpfptr.h:65:40: sparse: sparse: cast from non-scalar

vim +481 kernel/bpf/bpf_iter.c

6b0a249a301e2a Yonghong Song 2020-08-21  453  
6b0a249a301e2a Yonghong Song 2020-08-21  454  static int bpf_iter_link_fill_link_info(const struct bpf_link *link,
6b0a249a301e2a Yonghong Song 2020-08-21  455  					struct bpf_link_info *info)
6b0a249a301e2a Yonghong Song 2020-08-21  456  {
6b0a249a301e2a Yonghong Song 2020-08-21  457  	struct bpf_iter_link *iter_link =
6b0a249a301e2a Yonghong Song 2020-08-21  458  		container_of(link, struct bpf_iter_link, link);
6b0a249a301e2a Yonghong Song 2020-08-21  459  	char __user *ubuf = u64_to_user_ptr(info->iter.target_name);
6b0a249a301e2a Yonghong Song 2020-08-21  460  	bpf_iter_fill_link_info_t fill_link_info;
6b0a249a301e2a Yonghong Song 2020-08-21  461  	u32 ulen = info->iter.target_name_len;
6b0a249a301e2a Yonghong Song 2020-08-21  462  	const char *target_name;
6b0a249a301e2a Yonghong Song 2020-08-21  463  	u32 target_len;
6b0a249a301e2a Yonghong Song 2020-08-21  464  
6b0a249a301e2a Yonghong Song 2020-08-21  465  	if (!ulen ^ !ubuf)
6b0a249a301e2a Yonghong Song 2020-08-21  466  		return -EINVAL;
6b0a249a301e2a Yonghong Song 2020-08-21  467  
6b0a249a301e2a Yonghong Song 2020-08-21  468  	target_name = iter_link->tinfo->reg_info->target;
6b0a249a301e2a Yonghong Song 2020-08-21  469  	target_len =  strlen(target_name);
6b0a249a301e2a Yonghong Song 2020-08-21  470  	info->iter.target_name_len = target_len + 1;
6b0a249a301e2a Yonghong Song 2020-08-21  471  
6b0a249a301e2a Yonghong Song 2020-08-21  472  	if (ubuf) {
6b0a249a301e2a Yonghong Song 2020-08-21  473  		if (ulen >= target_len + 1) {
6b0a249a301e2a Yonghong Song 2020-08-21  474  			if (copy_to_user(ubuf, target_name, target_len + 1))
6b0a249a301e2a Yonghong Song 2020-08-21  475  				return -EFAULT;
6b0a249a301e2a Yonghong Song 2020-08-21  476  		} else {
6b0a249a301e2a Yonghong Song 2020-08-21  477  			char zero = '\0';
6b0a249a301e2a Yonghong Song 2020-08-21  478  
6b0a249a301e2a Yonghong Song 2020-08-21  479  			if (copy_to_user(ubuf, target_name, ulen - 1))
6b0a249a301e2a Yonghong Song 2020-08-21  480  				return -EFAULT;
6b0a249a301e2a Yonghong Song 2020-08-21 @481  			if (put_user(zero, ubuf + ulen - 1))
6b0a249a301e2a Yonghong Song 2020-08-21  482  				return -EFAULT;
6b0a249a301e2a Yonghong Song 2020-08-21  483  			return -ENOSPC;
6b0a249a301e2a Yonghong Song 2020-08-21  484  		}
6b0a249a301e2a Yonghong Song 2020-08-21  485  	}
6b0a249a301e2a Yonghong Song 2020-08-21  486  
6b0a249a301e2a Yonghong Song 2020-08-21  487  	fill_link_info = iter_link->tinfo->reg_info->fill_link_info;
6b0a249a301e2a Yonghong Song 2020-08-21  488  	if (fill_link_info)
6b0a249a301e2a Yonghong Song 2020-08-21  489  		return fill_link_info(&iter_link->aux, info);
6b0a249a301e2a Yonghong Song 2020-08-21  490  
6b0a249a301e2a Yonghong Song 2020-08-21  491  	return 0;
6b0a249a301e2a Yonghong Song 2020-08-21  492  }
6b0a249a301e2a Yonghong Song 2020-08-21  493  

:::::: The code at line 481 was first introduced by commit
:::::: 6b0a249a301e2af9adda84adbced3a2988248b95 bpf: Implement link_query for bpf iterators

:::::: TO: Yonghong Song <yhs@...com>
:::::: CC: Alexei Starovoitov <ast@...nel.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (122732 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ