From: kernel test robot <lkp@intel.com>
To: Stanislav Fomichev <sdf@google.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: kbuild-all@lists.01.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, Stanislav Fomichev <sdf@google.com>
Subject: Re: [PATCH bpf-next v7 05/11] bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP
Date: Thu, 19 May 2022 10:31:57 +0800 [thread overview]
Message-ID: <202205191035.Ja5udws3-lkp@intel.com> (raw)
In-Reply-To: <20220518225531.558008-6-sdf@google.com>
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: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220519/202205191035.Ja5udws3-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.3.0
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=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
kernel/bpf/cgroup.c: In function '__cgroup_bpf_query':
>> kernel/bpf/cgroup.c:1091:30: error: 'CGROUP_LSM_START' undeclared (first use in this function); did you mean 'CGROUP_LSM_NUM'?
1091 | from_atype = CGROUP_LSM_START;
| ^~~~~~~~~~~~~~~~
| CGROUP_LSM_NUM
kernel/bpf/cgroup.c:1091:30: note: each undeclared identifier is reported only once for each function it appears in
>> kernel/bpf/cgroup.c:1092:28: error: 'CGROUP_LSM_END' undeclared (first use in this function); did you mean 'CGROUP_LSM_NUM'?
1092 | to_atype = CGROUP_LSM_END;
| ^~~~~~~~~~~~~~
| CGROUP_LSM_NUM
vim +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
next prev parent reply other threads:[~2022-05-19 2:32 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 22:55 [PATCH bpf-next v7 00/11] bpf: cgroup_sock lsm flavor Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 01/11] bpf: add bpf_func_t and trampoline helpers Stanislav Fomichev
2022-05-20 0:45 ` Yonghong Song
2022-05-21 0:03 ` Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 02/11] bpf: convert cgroup_bpf.progs to hlist Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 03/11] bpf: per-cgroup lsm flavor Stanislav Fomichev
2022-05-20 1:00 ` Yonghong Song
2022-05-21 0:03 ` Stanislav Fomichev
2022-05-23 15:41 ` Yonghong Song
2022-05-21 0:53 ` Martin KaFai Lau
2022-05-24 2:15 ` Stanislav Fomichev
2022-05-24 5:40 ` Martin KaFai Lau
2022-05-24 15:56 ` Stanislav Fomichev
2022-05-24 5:57 ` Martin KaFai Lau
2022-05-18 22:55 ` [PATCH bpf-next v7 04/11] bpf: minimize number of allocated lsm slots per program Stanislav Fomichev
2022-05-21 6:56 ` Martin KaFai Lau
2022-05-24 2:14 ` Stanislav Fomichev
2022-05-24 5:53 ` Martin KaFai Lau
2022-05-18 22:55 ` [PATCH bpf-next v7 05/11] bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP Stanislav Fomichev
2022-05-19 2:31 ` kernel test robot [this message]
2022-05-19 14:57 ` kernel test robot
2022-05-23 23:23 ` Andrii Nakryiko
2022-05-24 2:15 ` Stanislav Fomichev
2022-05-24 3:48 ` Martin KaFai Lau
2022-05-24 15:55 ` Stanislav Fomichev
2022-05-24 17:50 ` Martin KaFai Lau
2022-05-24 23:45 ` Andrii Nakryiko
2022-05-25 4:03 ` Stanislav Fomichev
2022-05-25 4:39 ` Andrii Nakryiko
2022-05-25 16:01 ` Stanislav Fomichev
2022-05-25 17:02 ` Stanislav Fomichev
2022-05-25 20:39 ` Martin KaFai Lau
2022-05-25 21:25 ` sdf
2022-05-26 0:03 ` Martin KaFai Lau
2022-05-26 1:23 ` Martin KaFai Lau
2022-05-26 2:50 ` Stanislav Fomichev
2022-05-31 23:08 ` Andrii Nakryiko
2022-05-18 22:55 ` [PATCH bpf-next v7 06/11] bpf: allow writing to a subset of sock fields from lsm progtype Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 07/11] libbpf: implement bpf_prog_query_opts Stanislav Fomichev
2022-05-23 23:22 ` Andrii Nakryiko
2022-05-24 2:15 ` Stanislav Fomichev
2022-05-24 3:45 ` Andrii Nakryiko
2022-05-24 4:01 ` Martin KaFai Lau
2022-05-18 22:55 ` [PATCH bpf-next v7 08/11] libbpf: add lsm_cgoup_sock type Stanislav Fomichev
2022-05-23 23:26 ` Andrii Nakryiko
2022-05-24 2:15 ` Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 09/11] bpftool: implement cgroup tree for BPF_LSM_CGROUP Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 10/11] selftests/bpf: lsm_cgroup functional test Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 11/11] selftests/bpf: verify lsm_cgroup struct sock access Stanislav Fomichev
2022-05-23 23:33 ` Andrii Nakryiko
2022-05-24 2:15 ` Stanislav Fomichev
2022-05-24 3:46 ` Andrii Nakryiko
2022-05-19 23:34 ` [PATCH bpf-next v7 00/11] bpf: cgroup_sock lsm flavor Yonghong Song
2022-05-19 23:39 ` Stanislav Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202205191035.Ja5udws3-lkp@intel.com \
--to=lkp@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kbuild-all@lists.01.org \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.