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]
Date:   Thu, 24 Sep 2020 13:06:55 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Song Liu <songliubraving@...com>
Cc:     Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Kernel Team <kernel-team@...com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        john fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>
Subject: Re: [PATCH v4 bpf-next 2/3] libbpf: support test run of raw
 tracepoint programs

On Wed, Sep 23, 2020 at 6:45 PM Song Liu <songliubraving@...com> wrote:
>
> Add bpf_prog_test_run_opts() with support of new fields in bpf_attr.test,
> namely, flags and cpu. Also extend _opts operations to support outputs via
> opts.
>
> Signed-off-by: Song Liu <songliubraving@...com>
> ---
>  tools/lib/bpf/bpf.c             | 31 +++++++++++++++++++++++++++++++
>  tools/lib/bpf/bpf.h             | 26 ++++++++++++++++++++++++++
>  tools/lib/bpf/libbpf.map        |  1 +
>  tools/lib/bpf/libbpf_internal.h |  5 +++++
>  4 files changed, 63 insertions(+)
>

[...]

>  static int bpf_obj_get_next_id(__u32 start_id, __u32 *next_id, int cmd)
>  {
>         union bpf_attr attr;
> diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
> index 8c1ac4b42f908..4f13ec4323aff 100644
> --- a/tools/lib/bpf/bpf.h
> +++ b/tools/lib/bpf/bpf.h
> @@ -251,6 +251,32 @@ struct bpf_prog_bind_opts {
>
>  LIBBPF_API int bpf_prog_bind_map(int prog_fd, int map_fd,
>                                  const struct bpf_prog_bind_opts *opts);
> +
> +struct bpf_test_run_opts {
> +       size_t sz; /* size of this struct for forward/backward compatibility */
> +       int repeat;
> +       const void *data_in;
> +       __u32 data_size_in;
> +       void *data_out;      /* optional */
> +       __u32 data_size_out; /* in: max length of data_out
> +                             * out: length of data_out
> +                             */
> +       __u32 retval;        /* out: return code of the BPF program */
> +       __u32 duration;      /* out: average per repetition in ns */
> +       const void *ctx_in; /* optional */
> +       __u32 ctx_size_in;
> +       void *ctx_out;      /* optional */
> +       __u32 ctx_size_out; /* in: max length of ctx_out
> +                            * out: length of cxt_out
> +                            */
> +       __u32 flags;
> +       __u32 cpu;
> +};

lots of holes in there, let's reorder (it doesn't have to match the
order in bpf_attr):

      size_t sz; /* size of this struct for forward/backward compatibility */

      const void *data_in;
      void *data_out;
      __u32 data_size_in;
      __u32 data_size_out;

      const void *ctx_in;
      void *ctx_out;
      __u32 ctx_size_in;
      __u32 ctx_size_out;

      __u32 retval;
      int repeat;
      __u32 duration;
      __u32 flags;
      __u32 cpu;

?

> +#define bpf_test_run_opts__last_field cpu
> +
> +LIBBPF_API int bpf_prog_test_run_opts(int prog_fd,
> +                                     struct bpf_test_run_opts *opts);
> +
>  #ifdef __cplusplus
>  } /* extern "C" */
>  #endif

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ