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