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:   Thu, 18 Jun 2020 01:22:10 +0800
From:   kernel test robot <lkp@...el.com>
To:     Stanislav Fomichev <sdf@...gle.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Alexei Starovoitov <ast@...nel.org>
Subject: kernel/bpf/cgroup.c:1111:13: sparse: sparse: incorrect type in
 initializer (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   69119673bd50b176ded34032fadd41530fb5af21
commit: 0d01da6afc5402f60325c5da31b22f7d56689b49 bpf: implement getsockopt and setsockopt hooks
date:   12 months ago
config: openrisc-randconfig-s032-20200617 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-rc1-6-g78f577f8-dirty
        git checkout 0d01da6afc5402f60325c5da31b22f7d56689b49
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=openrisc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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 >>)

   kernel/bpf/cgroup.c:1073:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] <asn:1> *optlen @@
   kernel/bpf/cgroup.c:1073:21: sparse:     expected int const *__gu_addr
   kernel/bpf/cgroup.c:1073:21: sparse:     got int [noderef] <asn:1> *optlen
>> kernel/bpf/cgroup.c:1111:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] <asn:1> *optlen @@
>> kernel/bpf/cgroup.c:1111:13: sparse:     expected int *__pu_addr
   kernel/bpf/cgroup.c:1111:13: sparse:     got int [noderef] <asn:1> *optlen
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] <asn:1> *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] <asn:1> *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] <asn:1> *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] <asn:1> *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] <asn:1> *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] <asn:1> *from
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] <asn:1> *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] <asn:1> *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] <asn:1> *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] <asn:1> *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] <asn:1> *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] <asn:1> *from
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] <asn:1> *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] <asn:1> *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] <asn:1> *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] <asn:1> *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] <asn:1> *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] <asn:1> *from
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] <asn:1> *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] <asn:1> *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] <asn:1> *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] <asn:1> *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] <asn:1> *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] <asn:1> *from

vim +1111 kernel/bpf/cgroup.c

  1038	
  1039	int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
  1040					       int optname, char __user *optval,
  1041					       int __user *optlen, int max_optlen,
  1042					       int retval)
  1043	{
  1044		struct cgroup *cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data);
  1045		struct bpf_sockopt_kern ctx = {
  1046			.sk = sk,
  1047			.level = level,
  1048			.optname = optname,
  1049			.retval = retval,
  1050		};
  1051		int ret;
  1052	
  1053		/* Opportunistic check to see whether we have any BPF program
  1054		 * attached to the hook so we don't waste time allocating
  1055		 * memory and locking the socket.
  1056		 */
  1057		if (!cgroup_bpf_enabled ||
  1058		    __cgroup_bpf_prog_array_is_empty(cgrp, BPF_CGROUP_GETSOCKOPT))
  1059			return retval;
  1060	
  1061		ret = sockopt_alloc_buf(&ctx, max_optlen);
  1062		if (ret)
  1063			return ret;
  1064	
  1065		if (!retval) {
  1066			/* If kernel getsockopt finished successfully,
  1067			 * copy whatever was returned to the user back
  1068			 * into our temporary buffer. Set optlen to the
  1069			 * one that kernel returned as well to let
  1070			 * BPF programs inspect the value.
  1071			 */
  1072	
> 1073			if (get_user(ctx.optlen, optlen)) {
  1074				ret = -EFAULT;
  1075				goto out;
  1076			}
  1077	
  1078			if (ctx.optlen > max_optlen)
  1079				ctx.optlen = max_optlen;
  1080	
  1081			if (copy_from_user(ctx.optval, optval, ctx.optlen) != 0) {
  1082				ret = -EFAULT;
  1083				goto out;
  1084			}
  1085		}
  1086	
  1087		lock_sock(sk);
  1088		ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[BPF_CGROUP_GETSOCKOPT],
  1089					 &ctx, BPF_PROG_RUN);
  1090		release_sock(sk);
  1091	
  1092		if (!ret) {
  1093			ret = -EPERM;
  1094			goto out;
  1095		}
  1096	
  1097		if (ctx.optlen > max_optlen) {
  1098			ret = -EFAULT;
  1099			goto out;
  1100		}
  1101	
  1102		/* BPF programs only allowed to set retval to 0, not some
  1103		 * arbitrary value.
  1104		 */
  1105		if (ctx.retval != 0 && ctx.retval != retval) {
  1106			ret = -EFAULT;
  1107			goto out;
  1108		}
  1109	
  1110		if (copy_to_user(optval, ctx.optval, ctx.optlen) ||
> 1111		    put_user(ctx.optlen, optlen)) {
  1112			ret = -EFAULT;
  1113			goto out;
  1114		}
  1115	
  1116		ret = ctx.retval;
  1117	
  1118	out:
  1119		sockopt_free_buf(&ctx);
  1120		return ret;
  1121	}
  1122	EXPORT_SYMBOL(__cgroup_bpf_run_filter_getsockopt);
  1123	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ