From: kernel test robot <lkp@intel.com>
To: Blaise Boscaccy <bboscaccy@linux.microsoft.com>, bpf@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, nkapron@google.com,
teknoraver@meta.com, roberto.sassu@huawei.com,
gregkh@linuxfoundation.org, paul@paul-moore.com,
code@tyhicks.com, flaniel@linux.microsoft.com
Subject: Re: [PATCH 07/14] bpf: Implement BPF_LOAD_FD subcommand handler
Date: Sat, 11 Jan 2025 08:41:36 +0800 [thread overview]
Message-ID: <202501110812.QzSvbAtK-lkp@intel.com> (raw)
In-Reply-To: <20250109214617.485144-8-bboscaccy@linux.microsoft.com>
Hi Blaise,
kernel test robot noticed the following build warnings:
[auto build test WARNING on bpf/master]
[also build test WARNING on linus/master v6.13-rc6]
[cannot apply to bpf-next/master next-20250110]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Blaise-Boscaccy/bpf-Add-data-structures-for-managing-in-kernel-eBPF-relocations/20250110-064354
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master
patch link: https://lore.kernel.org/r/20250109214617.485144-8-bboscaccy%40linux.microsoft.com
patch subject: [PATCH 07/14] bpf: Implement BPF_LOAD_FD subcommand handler
config: i386-buildonly-randconfig-003-20250111 (https://download.01.org/0day-ci/archive/20250111/202501110812.QzSvbAtK-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250111/202501110812.QzSvbAtK-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501110812.QzSvbAtK-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/bpf/syscall.c: In function 'load_fd':
>> kernel/bpf/syscall.c:6290:47: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
6290 | if (copy_from_user(obj->maps, (const void *)attr->load_fd.maps,
| ^
kernel/bpf/syscall.c:6310:45: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
6310 | if (copy_from_user(modules, (const void *)attr->load_fd.modules,
| ^
kernel/bpf/syscall.c: At top level:
kernel/bpf/syscall.c:6092:1: warning: 'skip_mods_and_typedefs' defined but not used [-Wunused-function]
6092 | skip_mods_and_typedefs(const struct btf *btf, u32 id, u32 *res_id)
| ^~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:6082:13: warning: 'sym_is_extern' defined but not used [-Wunused-function]
6082 | static bool sym_is_extern(const Elf64_Sym *sym)
| ^~~~~~~~~~~~~
kernel/bpf/syscall.c:6056:12: warning: 'find_extern_sec_btf_id' defined but not used [-Wunused-function]
6056 | static int find_extern_sec_btf_id(struct btf *btf, int ext_btf_id)
| ^~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:6016:12: warning: 'find_extern_btf_id' defined but not used [-Wunused-function]
6016 | static int find_extern_btf_id(const struct btf *btf, const char *ext_name)
| ^~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:5998:12: warning: 'elf_sec_idx_by_name' defined but not used [-Wunused-function]
5998 | static int elf_sec_idx_by_name(struct bpf_obj *obj, const char *name)
| ^~~~~~~~~~~~~~~~~~~
kernel/bpf/syscall.c:5948:24: warning: 'btf_ext__new' defined but not used [-Wunused-function]
5948 | static struct btf_ext *btf_ext__new(const __u8 *data, __u32 size)
| ^~~~~~~~~~~~
vim +6290 kernel/bpf/syscall.c
6233
6234 static int load_fd(union bpf_attr *attr)
6235 {
6236 void *buf = NULL;
6237 int len;
6238 int i;
6239 int obj_f;
6240 struct fd obj_fd;
6241 struct bpf_module_obj *modules;
6242 struct bpf_obj *obj;
6243 int err;
6244
6245 struct fd f;
6246 struct fd bpffs_fd;
6247
6248 f = fdget(attr->load_fd.obj_fd);
6249 if (!fd_file(f)) {
6250 err = -EBADF;
6251 goto out;
6252 }
6253
6254 bpffs_fd = fdget(attr->load_fd.bpffs_fd);
6255 if (!fd_file(bpffs_fd)) {
6256 fdput(f);
6257 err = -EBADF;
6258 goto out;
6259 }
6260
6261 obj_f = loader_create(attr->load_fd.bpffs_fd);
6262 if (obj_f < 0) {
6263 err = obj_f;
6264 fdput(f);
6265 fdput(bpffs_fd);
6266 goto out;
6267 }
6268
6269 obj_fd = fdget(obj_f);
6270 obj = fd_file(obj_fd)->private_data;
6271
6272 len = kernel_read_file(fd_file(f), 0, &buf, INT_MAX, NULL, READING_EBPF);
6273 if (len < 0) {
6274 fdput(obj_fd);
6275 err = len;
6276 goto out;
6277 }
6278
6279 obj->hdr = buf;
6280 obj->len = len;
6281 obj->nr_maps = attr->load_fd.map_cnt;
6282 obj->maps = kmalloc_array(attr->load_fd.map_cnt, sizeof(struct bpf_map_obj), GFP_KERNEL);
6283
6284 if (!obj->maps) {
6285 err = -ENOMEM;
6286 goto free;
6287 }
6288
6289 if (attr->load_fd.map_cnt) {
> 6290 if (copy_from_user(obj->maps, (const void *)attr->load_fd.maps,
6291 sizeof(struct bpf_map_obj) * attr->load_fd.map_cnt) != 0) {
6292 err = -EFAULT;
6293 goto free;
6294 }
6295 }
6296
6297 obj->kconfig_map_idx = attr->load_fd.kconfig_map_idx;
6298 obj->arena_map_idx = attr->load_fd.arena_map_idx;
6299 obj->btf_vmlinux = bpf_get_btf_vmlinux();
6300 modules = kmalloc_array(attr->load_fd.module_cnt,
6301 sizeof(struct bpf_module_obj), GFP_KERNEL);
6302
6303 if (!modules) {
6304 err = -ENOMEM;
6305 goto free;
6306 }
6307
6308
6309 if (attr->load_fd.module_cnt) {
6310 if (copy_from_user(modules, (const void *)attr->load_fd.modules,
6311 sizeof(struct bpf_module_obj) * attr->load_fd.module_cnt) != 0) {
6312 err = -EFAULT;
6313 goto free;
6314 }
6315 }
6316
6317 obj->btf_modules_cnt = attr->load_fd.module_cnt;
6318 obj->btf_modules = kmalloc_array(attr->load_fd.module_cnt,
6319 sizeof(struct bpf_module_btf), GFP_KERNEL);
6320
6321 if (!obj->btf_modules) {
6322 err = -ENOMEM;
6323 goto free;
6324 }
6325
6326 for (i = 0; i < obj->btf_modules_cnt; i++) {
6327 obj->btf_modules[i].fd = modules[i].fd;
6328 obj->btf_modules[i].id = modules[i].id;
6329 obj->btf_modules[i].fd_array_idx = modules[i].fd_array_idx;
6330 obj->btf_modules[i].btf = btf_get_by_fd(obj->btf_modules[i].fd);
6331 if (IS_ERR(obj->btf_modules[i].btf)) {
6332 err = PTR_ERR(obj->btf_modules[i].btf);
6333 kfree(modules);
6334 goto free;
6335 }
6336 }
6337 kfree(modules);
6338
6339 return obj_f;
6340 free:
6341 free_bpf_obj(obj);
6342 fd_file(obj_fd)->private_data = NULL;
6343 out:
6344 return err;
6345 }
6346
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-01-11 0:42 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 21:43 [POC][RFC][PATCH] bpf: in-kernel bpf relocations on raw elf files Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 01/14] bpf: Port prerequiste BTF handling functions from userspace Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 02/14] bpf: Add data structures for managing in-kernel eBPF relocations Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 03/14] bpf: Port .btf.ext parsing functions from userspace Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 04/14] bpf: Port elf and btf utility helper " Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 05/14] fs/kernel_read_file: Add an eBPF specifier to kernel_read_file Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 06/14] bpf: Add BPF_LOAD_FD subcommand Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 07/14] bpf: Implement BPF_LOAD_FD subcommand handler Blaise Boscaccy
2025-01-10 6:05 ` Greg KH
2025-01-10 22:41 ` Blaise Boscaccy
2025-01-11 0:41 ` kernel test robot [this message]
2025-01-09 21:43 ` [PATCH 08/14] bpf: Add elf parsing support to the BPF_LOAD_FD subcommand Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 09/14] bpf: Collect extern relocations Blaise Boscaccy
2025-01-11 1:35 ` kernel test robot
2025-01-09 21:43 ` [PATCH 10/14] bpf: Implement BTF fixup functionality Blaise Boscaccy
2025-01-11 3:19 ` kernel test robot
2025-01-09 21:43 ` [PATCH 11/14] bpf: Implement relocation collection Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 12/14] bpf: Resolve external relocations Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 13/14] bpf: Apply in-kernel bpf instruction relocations Blaise Boscaccy
2025-01-09 21:43 ` [PATCH 14/14] bpf: Augment BPF_PROG_LOAD to use in-kernel relocations Blaise Boscaccy
2025-01-10 18:40 ` [POC][RFC][PATCH] bpf: in-kernel bpf relocations on raw elf files Alexei Starovoitov
2025-01-10 23:27 ` Blaise Boscaccy
2025-01-13 17:54 ` Alexei Starovoitov
2025-01-14 18:24 ` Blaise Boscaccy
2025-01-24 5:08 ` bpf signing. " Alexei Starovoitov
2025-01-24 7:05 ` John Fastabend
2025-01-28 22:32 ` Blaise Boscaccy
2025-01-30 1:13 ` Cong Wang
2025-01-30 19:22 ` Blaise Boscaccy
2025-02-01 22:24 ` Cong Wang
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=202501110812.QzSvbAtK-lkp@intel.com \
--to=lkp@intel.com \
--cc=bboscaccy@linux.microsoft.com \
--cc=bpf@vger.kernel.org \
--cc=code@tyhicks.com \
--cc=flaniel@linux.microsoft.com \
--cc=gregkh@linuxfoundation.org \
--cc=nkapron@google.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=paul@paul-moore.com \
--cc=roberto.sassu@huawei.com \
--cc=teknoraver@meta.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.