Re: [PATCH bpf-next v6 13/13] selftests/bpf: Add test for strict BTF type check

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

 



On Mon, Apr 25, 2022 at 8:39 PM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> 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

Kumar,

ping?
Are you still working on the follow up?



[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