lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYxDE5VoBiCaPwv=buUk87Cv0JF09usmQf0WvUceb8A5A@mail.gmail.com>
Date:   Thu, 19 Dec 2019 15:02:24 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Eelco Chaudron <echaudro@...hat.com>
Cc:     bpf <bpf@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Add a test for attaching a bpf
 fentry/fexit trace to an XDP program

On Thu, Dec 19, 2019 at 3:04 AM Eelco Chaudron <echaudro@...hat.com> wrote:
>
> Add a test that will attach a FENTRY and FEXIT program to the XDP test
> program. It will also verify data from the XDP context on FENTRY and
> verifies the return code on exit.
>
> Signed-off-by: Eelco Chaudron <echaudro@...hat.com>
> ---
>  .../testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c |   95 ++++++++++++++++++++
>  .../testing/selftests/bpf/progs/test_xdp_bpf2bpf.c |   44 +++++++++
>  2 files changed, 139 insertions(+)
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
>  create mode 100644 tools/testing/selftests/bpf/progs/test_xdp_bpf2bpf.c
>

[...]

> +       /* Load XDP program to introspect */
> +       err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);

Please use BPF skeleton for this test. It will make it significantly
shorter and clearer. See other fentry_fexit selftest for example.

> +       if (CHECK_FAIL(err))
> +               return;
> +

[...]

> +
> +static volatile __u64 test_result_fentry;

no need for static volatile anymore, just use global var

> +BPF_TRACE_1("fentry/_xdp_tx_iptunnel", trace_on_entry,
> +           struct xdp_buff *, xdp)
> +{
> +       test_result_fentry = xdp->rxq->dev->ifindex;
> +       return 0;
> +}
> +
> +static volatile __u64 test_result_fexit;

same here

> +BPF_TRACE_2("fexit/_xdp_tx_iptunnel", trace_on_exit,
> +           struct xdp_buff*, xdp, int, ret)
> +{
> +       test_result_fexit = ret;
> +       return 0;
> +}
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ