Re: [PATCH bpf-next v16 08/14] bpf: pass attached BTF to the bpf_struct_ops subsystem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1/18/24 13:56, Martin KaFai Lau wrote:
On 1/17/24 5:49 PM, thinker.li@xxxxxxxxx wrote:
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 0744a1f194fa..ff41f7736618 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -20234,6 +20234,7 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env)
      const struct btf_member *member;
      struct bpf_prog *prog = env->prog;
      u32 btf_id, member_idx;
+    struct btf *btf;
      const char *mname;
      if (!prog->gpl_compatible) {
@@ -20241,8 +20242,10 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env)
          return -EINVAL;
      }
+    btf = prog->aux->attach_btf ?: bpf_get_btf_vmlinux();
+

just "btf = prog->aux->attach_btf;" which was assigned to bpf_get_btf_vmlinux() for the non-module case. Take a look at bpf_prog_load() in syscall.c

You are right. I have been too protective here.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux