Hi Lorenz,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master v5.15-rc5 next-20211013]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Lorenz-Bauer/uapi-bpf-h-for-robo...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: openrisc-buildonly-randconfig-r004-20211014 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.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/0day-ci/linux/commit/3b259b92970a70db700a73212711945e3...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Lorenz-Bauer/uapi-bpf-h-for-robots/20211014-223605
git checkout 3b259b92970a70db700a73212711945e3ca0f9c2
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir
ARCH=openrisc SHELL=/bin/bash kernel/bpf/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
kernel/bpf/syscall.c: In function 'map_lookup_elem':
> kernel/bpf/syscall.c:1053:23: error: 'struct
bpf_map_lookup_elem_attr' has no member named 'fd'
1053 |
int ufd = attr->fd;
| ^~
kernel/bpf/syscall.c: In function 'map_update_elem':
> kernel/bpf/syscall.c:1114:23: error: 'struct
bpf_map_update_elem_attr' has no member named 'fd'
1114 |
int ufd = attr->fd;
| ^~
kernel/bpf/syscall.c: In function 'map_delete_elem':
> kernel/bpf/syscall.c:1167:23: error: 'struct
bpf_map_delete_elem_attr' has no member named 'fd'
1167 |
int ufd = attr->fd;
| ^~
kernel/bpf/syscall.c: In function 'map_get_next_key':
> kernel/bpf/syscall.c:1215:23: error: 'struct
bpf_map_get_next_key_attr' has no member named 'fd'
1215 |
int ufd = attr->fd;
| ^~
vim +1053 kernel/bpf/syscall.c
1048
1049 static int map_lookup_elem(struct bpf_map_lookup_elem_attr *attr)
1050 {
1051 void __user *ukey = u64_to_user_ptr(attr->key_u64);
1052 void __user *uvalue = u64_to_user_ptr(attr->value_u64);
1053 int ufd = attr->fd;
1054 struct bpf_map *map;
1055 void *key, *value;
1056 u32 value_size;
1057 struct fd f;
1058 int err;
1059
1060 if (attr->flags & ~BPF_F_LOCK)
1061 return -EINVAL;
1062
1063 f = fdget(ufd);
1064 map = __bpf_map_get(f);
1065 if (IS_ERR(map))
1066 return PTR_ERR(map);
1067 if (!(map_get_sys_perms(map, f) & FMODE_CAN_READ)) {
1068 err = -EPERM;
1069 goto err_put;
1070 }
1071
1072 if ((attr->flags & BPF_F_LOCK) &&
1073 !map_value_has_spin_lock(map)) {
1074 err = -EINVAL;
1075 goto err_put;
1076 }
1077
1078 key = __bpf_copy_key(ukey, map->key_size);
1079 if (IS_ERR(key)) {
1080 err = PTR_ERR(key);
1081 goto err_put;
1082 }
1083
1084 value_size = bpf_map_value_size(map);
1085
1086 err = -ENOMEM;
1087 value = kvmalloc(value_size, GFP_USER | __GFP_NOWARN);
1088 if (!value)
1089 goto free_key;
1090
1091 err = bpf_map_copy_value(map, key, value, attr->flags);
1092 if (err)
1093 goto free_value;
1094
1095 err = -EFAULT;
1096 if (copy_to_user(uvalue, value, value_size) != 0)
1097 goto free_value;
1098
1099 err = 0;
1100
1101 free_value:
1102 kvfree(value);
1103 free_key:
1104 kvfree(key);
1105 err_put:
1106 fdput(f);
1107 return err;
1108 }
1109
1110 static int map_update_elem(struct bpf_map_update_elem_attr *attr, bpfptr_t uattr)
1111 {
1112 bpfptr_t ukey = make_bpfptr(attr->key_u64, uattr.is_kernel);
1113 bpfptr_t uvalue = make_bpfptr(attr->value_u64, uattr.is_kernel);
1114 int ufd = attr->fd;
1115 struct bpf_map *map;
1116 void *key, *value;
1117 u32 value_size;
1118 struct fd f;
1119 int err;
1120
1121 f = fdget(ufd);
1122 map = __bpf_map_get(f);
1123 if (IS_ERR(map))
1124 return PTR_ERR(map);
1125 if (!(map_get_sys_perms(map, f) & FMODE_CAN_WRITE)) {
1126 err = -EPERM;
1127 goto err_put;
1128 }
1129
1130 if ((attr->flags & BPF_F_LOCK) &&
1131 !map_value_has_spin_lock(map)) {
1132 err = -EINVAL;
1133 goto err_put;
1134 }
1135
1136 key = ___bpf_copy_key(ukey, map->key_size);
1137 if (IS_ERR(key)) {
1138 err = PTR_ERR(key);
1139 goto err_put;
1140 }
1141
1142 value_size = bpf_map_value_size(map);
1143
1144 err = -ENOMEM;
1145 value = kvmalloc(value_size, GFP_USER | __GFP_NOWARN);
1146 if (!value)
1147 goto free_key;
1148
1149 err = -EFAULT;
1150 if (copy_from_bpfptr(value, uvalue, value_size) != 0)
1151 goto free_value;
1152
1153 err = bpf_map_update_value(map, f, key, value, attr->flags);
1154
1155 free_value:
1156 kvfree(value);
1157 free_key:
1158 kvfree(key);
1159 err_put:
1160 fdput(f);
1161 return err;
1162 }
1163
1164 static int map_delete_elem(struct bpf_map_delete_elem_attr *attr)
1165 {
1166 void __user *ukey = u64_to_user_ptr(attr->key_u64);
1167 int ufd = attr->fd;
1168 struct bpf_map *map;
1169 struct fd f;
1170 void *key;
1171 int err;
1172
1173 f = fdget(ufd);
1174 map = __bpf_map_get(f);
1175 if (IS_ERR(map))
1176 return PTR_ERR(map);
1177 if (!(map_get_sys_perms(map, f) & FMODE_CAN_WRITE)) {
1178 err = -EPERM;
1179 goto err_put;
1180 }
1181
1182 key = __bpf_copy_key(ukey, map->key_size);
1183 if (IS_ERR(key)) {
1184 err = PTR_ERR(key);
1185 goto err_put;
1186 }
1187
1188 if (bpf_map_is_dev_bound(map)) {
1189 err = bpf_map_offload_delete_elem(map, key);
1190 goto out;
1191 } else if (IS_FD_PROG_ARRAY(map) ||
1192 map->map_type == BPF_MAP_TYPE_STRUCT_OPS) {
1193 /* These maps require sleepable context */
1194 err = map->ops->map_delete_elem(map, key);
1195 goto out;
1196 }
1197
1198 bpf_disable_instrumentation();
1199 rcu_read_lock();
1200 err = map->ops->map_delete_elem(map, key);
1201 rcu_read_unlock();
1202 bpf_enable_instrumentation();
1203 maybe_wait_bpf_programs(map);
1204 out:
1205 kvfree(key);
1206 err_put:
1207 fdput(f);
1208 return err;
1209 }
1210
1211 static int map_get_next_key(struct bpf_map_get_next_key_attr *attr)
1212 {
1213 void __user *ukey = u64_to_user_ptr(attr->key_u64);
1214 void __user *unext_key = u64_to_user_ptr(attr->next_key_u64);
1215 int ufd = attr->fd;
1216 struct bpf_map *map;
1217 void *key, *next_key;
1218 struct fd f;
1219 int err;
1220
1221 f = fdget(ufd);
1222 map = __bpf_map_get(f);
1223 if (IS_ERR(map))
1224 return PTR_ERR(map);
1225 if (!(map_get_sys_perms(map, f) & FMODE_CAN_READ)) {
1226 err = -EPERM;
1227 goto err_put;
1228 }
1229
1230 if (ukey) {
1231 key = __bpf_copy_key(ukey, map->key_size);
1232 if (IS_ERR(key)) {
1233 err = PTR_ERR(key);
1234 goto err_put;
1235 }
1236 } else {
1237 key = NULL;
1238 }
1239
1240 err = -ENOMEM;
1241 next_key = kvmalloc(map->key_size, GFP_USER);
1242 if (!next_key)
1243 goto free_key;
1244
1245 if (bpf_map_is_dev_bound(map)) {
1246 err = bpf_map_offload_get_next_key(map, key, next_key);
1247 goto out;
1248 }
1249
1250 rcu_read_lock();
1251 err = map->ops->map_get_next_key(map, key, next_key);
1252 rcu_read_unlock();
1253 out:
1254 if (err)
1255 goto free_next_key;
1256
1257 err = -EFAULT;
1258 if (copy_to_user(unext_key, next_key, map->key_size) != 0)
1259 goto free_next_key;
1260
1261 err = 0;
1262
1263 free_next_key:
1264 kvfree(next_key);
1265 free_key:
1266 kvfree(key);
1267 err_put:
1268 fdput(f);
1269 return err;
1270 }
1271
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org