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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202205192210.FPl5GoFS-lkp@intel.com>
Date:   Thu, 19 May 2022 22:57:24 +0800
From:   kernel test robot <lkp@...el.com>
To:     Stanislav Fomichev <sdf@...gle.com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org, ast@...nel.org,
        daniel@...earbox.net, andrii@...nel.org,
        Stanislav Fomichev <sdf@...gle.com>
Subject: Re: [PATCH bpf-next v7 05/11] bpf: implement BPF_PROG_QUERY for
 BPF_LSM_CGROUP

Hi Stanislav,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Stanislav-Fomichev/bpf-cgroup_sock-lsm-flavor/20220519-065944
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: hexagon-randconfig-r035-20220519 (https://download.01.org/0day-ci/archive/20220519/202205192210.FPl5GoFS-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project e00cbbec06c08dc616a0d52a20f678b8fbd4e304)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/f3b115441e4b11ef3e65cad30e1c8fb7a2becfab
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Stanislav-Fomichev/bpf-cgroup_sock-lsm-flavor/20220519-065944
        git checkout f3b115441e4b11ef3e65cad30e1c8fb7a2becfab
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/bpf/ lib/

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

All errors (new ones prefixed by >>):

>> kernel/bpf/cgroup.c:1091:16: error: use of undeclared identifier 'CGROUP_LSM_START'
                   from_atype = CGROUP_LSM_START;
                                ^
>> kernel/bpf/cgroup.c:1092:14: error: use of undeclared identifier 'CGROUP_LSM_END'
                   to_atype = CGROUP_LSM_END;
                              ^
   2 errors generated.


vim +/CGROUP_LSM_START +1091 kernel/bpf/cgroup.c

  1072	
  1073	/* Must be called with cgroup_mutex held to avoid races. */
  1074	static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
  1075				      union bpf_attr __user *uattr)
  1076	{
  1077		__u32 __user *prog_attach_flags = u64_to_user_ptr(attr->query.prog_attach_flags);
  1078		__u32 __user *prog_ids = u64_to_user_ptr(attr->query.prog_ids);
  1079		enum bpf_attach_type type = attr->query.attach_type;
  1080		enum cgroup_bpf_attach_type atype;
  1081		struct bpf_prog_array *effective;
  1082		struct hlist_head *progs;
  1083		struct bpf_prog *prog;
  1084		int cnt, ret = 0, i;
  1085		int total_cnt = 0;
  1086		u32 flags;
  1087	
  1088		enum cgroup_bpf_attach_type from_atype, to_atype;
  1089	
  1090		if (type == BPF_LSM_CGROUP) {
> 1091			from_atype = CGROUP_LSM_START;
> 1092			to_atype = CGROUP_LSM_END;
  1093		} else {
  1094			from_atype = to_cgroup_bpf_attach_type(type);
  1095			if (from_atype < 0)
  1096				return -EINVAL;
  1097			to_atype = from_atype;
  1098		}
  1099	
  1100		for (atype = from_atype; atype <= to_atype; atype++) {
  1101			progs = &cgrp->bpf.progs[atype];
  1102			flags = cgrp->bpf.flags[atype];
  1103	
  1104			effective = rcu_dereference_protected(cgrp->bpf.effective[atype],
  1105							      lockdep_is_held(&cgroup_mutex));
  1106	
  1107			if (attr->query.query_flags & BPF_F_QUERY_EFFECTIVE)
  1108				total_cnt += bpf_prog_array_length(effective);
  1109			else
  1110				total_cnt += prog_list_length(progs);
  1111		}
  1112	
  1113		if (type != BPF_LSM_CGROUP)
  1114			if (copy_to_user(&uattr->query.attach_flags, &flags, sizeof(flags)))
  1115				return -EFAULT;
  1116		if (copy_to_user(&uattr->query.prog_cnt, &total_cnt, sizeof(total_cnt)))
  1117			return -EFAULT;
  1118		if (attr->query.prog_cnt == 0 || !prog_ids || !total_cnt)
  1119			/* return early if user requested only program count + flags */
  1120			return 0;
  1121	
  1122		if (attr->query.prog_cnt < total_cnt) {
  1123			total_cnt = attr->query.prog_cnt;
  1124			ret = -ENOSPC;
  1125		}
  1126	
  1127		for (atype = from_atype; atype <= to_atype; atype++) {
  1128			if (total_cnt <= 0)
  1129				break;
  1130	
  1131			progs = &cgrp->bpf.progs[atype];
  1132			flags = cgrp->bpf.flags[atype];
  1133	
  1134			effective = rcu_dereference_protected(cgrp->bpf.effective[atype],
  1135							      lockdep_is_held(&cgroup_mutex));
  1136	
  1137			if (attr->query.query_flags & BPF_F_QUERY_EFFECTIVE)
  1138				cnt = bpf_prog_array_length(effective);
  1139			else
  1140				cnt = prog_list_length(progs);
  1141	
  1142			if (cnt >= total_cnt)
  1143				cnt = total_cnt;
  1144	
  1145			if (attr->query.query_flags & BPF_F_QUERY_EFFECTIVE) {
  1146				ret = bpf_prog_array_copy_to_user(effective, prog_ids, cnt);
  1147			} else {
  1148				struct bpf_prog_list *pl;
  1149				u32 id;
  1150	
  1151				i = 0;
  1152				hlist_for_each_entry(pl, progs, node) {
  1153					prog = prog_list_prog(pl);
  1154					id = prog->aux->id;
  1155					if (copy_to_user(prog_ids + i, &id, sizeof(id)))
  1156						return -EFAULT;
  1157					if (++i == cnt)
  1158						break;
  1159				}
  1160			}
  1161	
  1162			if (prog_attach_flags)
  1163				for (i = 0; i < cnt; i++)
  1164					if (copy_to_user(prog_attach_flags + i, &flags, sizeof(flags)))
  1165						return -EFAULT;
  1166	
  1167			prog_ids += cnt;
  1168			total_cnt -= cnt;
  1169			if (prog_attach_flags)
  1170				prog_attach_flags += cnt;
  1171		}
  1172		return ret;
  1173	}
  1174	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ