Re: [PATCH bpf-next] bpf: make the attach target more accurate

From: kernel test robot
Date: Mon Jul 07 2025 - 16:25:57 EST


Hi Menglong,

kernel test robot noticed the following build errors:

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

url: https://github.com/intel-lab-lkp/linux/commits/Menglong-Dong/bpf-make-the-attach-target-more-accurate/20250707-194159
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20250707113528.378303-1-dongml2%40chinatelecom.cn
patch subject: [PATCH bpf-next] bpf: make the attach target more accurate
config: i386-buildonly-randconfig-003-20250708 (https://download.01.org/0day-ci/archive/20250708/202507080452.fCL471ap-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250708/202507080452.fCL471ap-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507080452.fCL471ap-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> kernel/bpf/verifier.c:23491:43: error: incomplete definition of type 'const struct module'
23491 | err = module_kallsyms_on_each_symbol(mod->name, symbol_mod_callback,
| ~~~^
include/linux/printk.h:400:8: note: forward declaration of 'struct module'
400 | struct module;
| ^
1 error generated.


vim +23491 kernel/bpf/verifier.c

23466
23467 /**
23468 * bpf_lookup_attach_addr: Lookup address for a symbol
23469 *
23470 * @mod: kernel module to lookup the symbol, NULL means to lookup the kernel
23471 * symbols
23472 * @sym: the symbol to resolve
23473 * @addr: pointer to store the result
23474 *
23475 * Lookup the address of the symbol @sym, and the address should has
23476 * corresponding ftrace location. If multiple symbols with the name @sym
23477 * exist, the one that has ftrace location will be returned. If more than
23478 * 1 has ftrace location, -EADDRNOTAVAIL will be returned.
23479 *
23480 * Returns: 0 on success, -errno otherwise.
23481 */
23482 static int bpf_lookup_attach_addr(const struct module *mod, const char *sym,
23483 unsigned long *addr)
23484 {
23485 struct symbol_lookup_ctx ctx = { .addr = 0, .name = sym };
23486 int err;
23487
23488 if (!mod)
23489 err = kallsyms_on_each_match_symbol(symbol_callback, sym, &ctx);
23490 else
23491 err = module_kallsyms_on_each_symbol(mod->name, symbol_mod_callback,
23492 &ctx);
23493
23494 if (!ctx.addr)
23495 return -ENOENT;
23496
23497 if (err)
23498 return err;
23499
23500 *addr = ctx.addr;
23501
23502 return 0;
23503 }
23504

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki