Re: [PATCH bpf-next 9/9] selftests/bpf: Add MSan annotations

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

 



On Wed, Feb 8, 2023 at 12:57 PM Ilya Leoshkevich <iii@xxxxxxxxxxxxx> wrote:
>
> eBPF selftests produce a few false positives with MSan. These can be
> divided in two classes:
>
> - Sending uninitalized data via a socket.
> - bpf_obj_get_info_by_fd() calls.
>
> The first class is trivial; the second should ideally be handled by
> libbpf, but it doesn't look possible at the moment, since we don't
> know the type of the eBPF object referred to by fd, and therefore the
> structure of the output data.

yeah, bpf_obj_get_info_by_fd() is quite bad from usability standpoint.
I think we should add bpf_get_{map,prog,link,btf}_info_by_fd()
wrappers and try to use them. That will allow to specify correct
expected struct types, we'll be able to mark initialized memory
properly. We already have bpf_{map,prog,btf,link}_get_fd_by_id()
family, so having similar for getting info seems fitting (even if
underlying bpf() command is generic).

Thoughts?

>
> Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
> ---
>  tools/testing/selftests/bpf/cap_helpers.c             |  3 +++
>  tools/testing/selftests/bpf/prog_tests/bpf_obj_id.c   | 10 ++++++++++
>  tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c   |  3 +++
>  tools/testing/selftests/bpf/prog_tests/btf.c          | 11 +++++++++++
>  tools/testing/selftests/bpf/prog_tests/send_signal.c  |  2 ++
>  .../selftests/bpf/prog_tests/tp_attach_query.c        |  6 ++++++
>  tools/testing/selftests/bpf/prog_tests/xdp_bonding.c  |  3 +++
>  tools/testing/selftests/bpf/xdp_synproxy.c            |  2 ++
>  8 files changed, 40 insertions(+)
>

[...]



[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