On Mon, Apr 25, 2022 at 03:19:01AM +0530, Kumar Kartikeya Dwivedi wrote: > > diff --git a/tools/testing/selftests/bpf/verifier/calls.c b/tools/testing/selftests/bpf/verifier/calls.c > index 2e03decb11b6..743ed34c1238 100644 > --- a/tools/testing/selftests/bpf/verifier/calls.c > +++ b/tools/testing/selftests/bpf/verifier/calls.c > @@ -138,6 +138,26 @@ > { "bpf_kfunc_call_memb_release", 8 }, > }, > }, > +{ > + "calls: invalid kfunc call: don't match first member type when passed to release kfunc", > + .insns = { > + BPF_MOV64_IMM(BPF_REG_0, 0), > + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, BPF_PSEUDO_KFUNC_CALL, 0, 0), > + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), > + BPF_EXIT_INSN(), > + BPF_MOV64_REG(BPF_REG_1, BPF_REG_0), > + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, BPF_PSEUDO_KFUNC_CALL, 0, 0), > + BPF_MOV64_IMM(BPF_REG_0, 0), > + BPF_EXIT_INSN(), > + }, > + .prog_type = BPF_PROG_TYPE_SCHED_CLS, > + .result = REJECT, > + .errstr = "kernel function bpf_kfunc_call_memb1_release args#0 expected pointer", > + .fixup_kfunc_btf_id = { > + { "bpf_kfunc_call_memb_acquire", 1 }, > + { "bpf_kfunc_call_memb1_release", 5 }, > + }, > +}, Please add negative C tests as well. Consider using SEC("?tc") logic added by commit 0d7fefebea552 and put a bunch of bpf progs that should fail to load in one .c