[PATCH v2 08/13] bpf: Implement signature verification for BPF programs
Dan Carpenter
dan.carpenter at linaro.org
Thu Jul 31 15:57:38 UTC 2025
Hi KP,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/KP-Singh/bpf-Update-the-bpf_prog_calc_tag-to-use-SHA256/20250722-052316
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20250721211958.1881379-9-kpsingh%40kernel.org
patch subject: [PATCH v2 08/13] bpf: Implement signature verification for BPF programs
config: m68k-randconfig-r073-20250723 (https://download.01.org/0day-ci/archive/20250723/202507231202.8rYZJ8D1-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.3.0
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 at intel.com>
| Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
| Closes: https://lore.kernel.org/r/202507231202.8rYZJ8D1-lkp@intel.com/
smatch warnings:
kernel/bpf/syscall.c:2797 bpf_prog_verify_signature() warn: 'sig' is an error pointer or valid
vim +/sig +2797 kernel/bpf/syscall.c
c83b0ba795b625 KP Singh 2025-07-21 2782 static noinline int bpf_prog_verify_signature(struct bpf_prog *prog,
c83b0ba795b625 KP Singh 2025-07-21 2783 union bpf_attr *attr,
c83b0ba795b625 KP Singh 2025-07-21 2784 bool is_kernel)
c83b0ba795b625 KP Singh 2025-07-21 2785 {
c83b0ba795b625 KP Singh 2025-07-21 2786 bpfptr_t usig = make_bpfptr(attr->signature, is_kernel);
c83b0ba795b625 KP Singh 2025-07-21 2787 struct bpf_dynptr_kern sig_ptr, insns_ptr;
c83b0ba795b625 KP Singh 2025-07-21 2788 struct bpf_key *key = NULL;
c83b0ba795b625 KP Singh 2025-07-21 2789 void *sig;
c83b0ba795b625 KP Singh 2025-07-21 2790 int err = 0;
c83b0ba795b625 KP Singh 2025-07-21 2791
c83b0ba795b625 KP Singh 2025-07-21 2792 key = bpf_lookup_user_key(attr->keyring_id, 0);
c83b0ba795b625 KP Singh 2025-07-21 2793 if (!key)
c83b0ba795b625 KP Singh 2025-07-21 2794 return -ENOKEY;
c83b0ba795b625 KP Singh 2025-07-21 2795
c83b0ba795b625 KP Singh 2025-07-21 2796 sig = kvmemdup_bpfptr(usig, attr->signature_size);
c83b0ba795b625 KP Singh 2025-07-21 @2797 if (!sig) {
This should be an if (!IS_ERR(sig)) { check.
c83b0ba795b625 KP Singh 2025-07-21 2798 bpf_key_put(key);
c83b0ba795b625 KP Singh 2025-07-21 2799 return -ENOMEM;
c83b0ba795b625 KP Singh 2025-07-21 2800 }
c83b0ba795b625 KP Singh 2025-07-21 2801
c83b0ba795b625 KP Singh 2025-07-21 2802 bpf_dynptr_init(&sig_ptr, sig, BPF_DYNPTR_TYPE_LOCAL, 0,
c83b0ba795b625 KP Singh 2025-07-21 2803 attr->signature_size);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the Linux-security-module-archive
mailing list