Re: [PATCH bpf-next 0/3] Fix BPF verifier global subprog context argument logic

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

 



On Tue, Feb 14, 2023 at 7:13 PM Stanislav Fomichev <sdf@xxxxxxxxxx> wrote:
>
> On 02/14, Andrii Nakryiko wrote:
> > Fix kernel bug in determining whether global subprog's argument is
> > PTR_TO_CTX,
> > which is done based on type names. Currently KPROBE programs are broken.
>
> > Add few tests validating that KPROBE context can be passed to global
> > subprog.
> > For that also refactor test_global_funcs test to use test_loader
> > framework.
>
> Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
>
> That endless loop+again in the first patch raised my brows a bit.
> But I'm assuming they are fine since we are working on a verified
> btf_vmlinux at this point...

it can't be a loop, because we are either on non-modifier type on the
first try, or will be on non-modifier after first retry. And then:

if (!btf_type_is_modifier(ctx_struct))
    return NULL;

It could be endless only if we have CONST/VOLATILE/RESTRICT/TYPEDEF
pointing to itself (as folks are investigating on another thread), but
that's a total corruption of BTF and lots of other places will break
even earlier.


>
>
> > Andrii Nakryiko (3):
> >    bpf: fix global subprog context argument resolution logic
> >    selftests/bpf: convert test_global_funcs test to test_loader framework
> >    selftests/bpf: add global subprog context passing tests
>
> >   kernel/bpf/btf.c                              |  13 +-
> >   .../bpf/prog_tests/test_global_funcs.c        | 133 +++++-------------
> >   .../selftests/bpf/progs/test_global_func1.c   |   6 +-
> >   .../selftests/bpf/progs/test_global_func10.c  |   4 +-
> >   .../selftests/bpf/progs/test_global_func11.c  |   4 +-
> >   .../selftests/bpf/progs/test_global_func12.c  |   4 +-
> >   .../selftests/bpf/progs/test_global_func13.c  |   4 +-
> >   .../selftests/bpf/progs/test_global_func14.c  |   4 +-
> >   .../selftests/bpf/progs/test_global_func15.c  |   4 +-
> >   .../selftests/bpf/progs/test_global_func16.c  |   4 +-
> >   .../selftests/bpf/progs/test_global_func17.c  |   4 +-
> >   .../selftests/bpf/progs/test_global_func2.c   |  43 +++++-
> >   .../selftests/bpf/progs/test_global_func3.c   |  10 +-
> >   .../selftests/bpf/progs/test_global_func4.c   |  55 +++++++-
> >   .../selftests/bpf/progs/test_global_func5.c   |   4 +-
> >   .../selftests/bpf/progs/test_global_func6.c   |   4 +-
> >   .../selftests/bpf/progs/test_global_func7.c   |   4 +-
> >   .../selftests/bpf/progs/test_global_func8.c   |   4 +-
> >   .../selftests/bpf/progs/test_global_func9.c   |   4 +-
> >   .../bpf/progs/test_global_func_ctx_args.c     | 105 ++++++++++++++
> >   20 files changed, 292 insertions(+), 125 deletions(-)
> >   create mode 100644
> > tools/testing/selftests/bpf/progs/test_global_func_ctx_args.c
>
> > --
> > 2.30.2
>



[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