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  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:   Fri, 11 Sep 2020 14:21:08 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Toke Høiland-Jørgensen <toke@...hat.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andriin@...com>,
        John Fastabend <john.fastabend@...il.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Eelco Chaudron <echaudro@...hat.com>,
        KP Singh <kpsingh@...omium.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH RESEND bpf-next v3 7/9] libbpf: add support for supplying
 target to bpf_raw_tracepoint_open()

On Fri, Sep 11, 2020 at 3:00 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> From: Toke Høiland-Jørgensen <toke@...hat.com>
>
> This adds support for supplying a target fd and btf ID for the
> raw_tracepoint_open() BPF operation, using a new bpf_raw_tracepoint_opts
> structure. This can be used for attaching freplace programs to multiple
> destinations.
>
> Signed-off-by: Toke Høiland-Jørgensen <toke@...hat.com>
> ---
>  tools/lib/bpf/bpf.c      |   13 ++++++++++++-
>  tools/lib/bpf/bpf.h      |    9 +++++++++
>  tools/lib/bpf/libbpf.map |    1 +
>  3 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index 82b983ff6569..25c62993c406 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -804,17 +804,28 @@ int bpf_obj_get_info_by_fd(int bpf_fd, void *info, __u32 *info_len)
>         return err;
>  }
>
> -int bpf_raw_tracepoint_open(const char *name, int prog_fd)
> +int bpf_raw_tracepoint_open_opts(const char *name, int prog_fd,

We've had discussion around naming low-level APIs with options and
agreed with Andrey Ignatov that we'll follow the _xattr suffix naming
for low-level APIs. So let's keep it consistent, I suppose...

Please also add bpf_program__attach_trace_opts() for high-level API.

> +                                struct bpf_raw_tracepoint_opts *opts)
>  {
>         union bpf_attr attr;
>
> +       if (!OPTS_VALID(opts, bpf_raw_tracepoint_opts))
> +               return -EINVAL;
> +
>         memset(&attr, 0, sizeof(attr));
>         attr.raw_tracepoint.name = ptr_to_u64(name);
>         attr.raw_tracepoint.prog_fd = prog_fd;
> +       attr.raw_tracepoint.tgt_prog_fd = OPTS_GET(opts, tgt_prog_fd, 0);
> +       attr.raw_tracepoint.tgt_btf_id = OPTS_GET(opts, tgt_btf_id, 0);
>
>         return sys_bpf(BPF_RAW_TRACEPOINT_OPEN, &attr, sizeof(attr));
>  }
>

[...]

Powered by blists - more mailing lists