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] [day] [month] [year] [list]
Message-ID: <CAMB2axMFJFub4G5j_a0vTdY778r61KLcxxuWG0z9ftktqLbQgQ@mail.gmail.com>
Date: Tue, 25 Nov 2025 15:56:01 -0800
From: Amery Hung <ameryhung@...il.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, alexei.starovoitov@...il.com, 
	andrii@...nel.org, daniel@...earbox.net, tj@...nel.org, martin.lau@...nel.org, 
	kernel-team@...a.com
Subject: Re: [PATCH bpf-next v7 3/6] libbpf: Add support for associating BPF
 program with struct_ops

On Tue, Nov 25, 2025 at 3:54 PM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Fri, Nov 21, 2025 at 3:14 PM Amery Hung <ameryhung@...il.com> wrote:
> >
> > Add low-level wrapper and libbpf API for BPF_PROG_ASSOC_STRUCT_OPS
> > command in the bpf() syscall.
> >
> > Signed-off-by: Amery Hung <ameryhung@...il.com>
> > ---
> >  tools/lib/bpf/bpf.c      | 19 +++++++++++++++++++
> >  tools/lib/bpf/bpf.h      | 21 +++++++++++++++++++++
> >  tools/lib/bpf/libbpf.c   | 31 +++++++++++++++++++++++++++++++
> >  tools/lib/bpf/libbpf.h   | 16 ++++++++++++++++
> >  tools/lib/bpf/libbpf.map |  2 ++
> >  5 files changed, 89 insertions(+)
> >
>
> [...]
>
> >
> > +int bpf_program__assoc_struct_ops(struct bpf_program *prog, struct bpf_map *map,
> > +                                 struct bpf_prog_assoc_struct_ops_opts *opts)
> > +{
> > +       int prog_fd, map_fd;
> > +
> > +       prog_fd = bpf_program__fd(prog);
> > +       if (prog_fd < 0) {
> > +               pr_warn("prog '%s': can't associate BPF program without FD (was it loaded?)\n",
> > +                       prog->name);
> > +               return -EINVAL;
>
> This is an error return path from the public libbpf API, please use
> libbpf_err() everywhere to ensure errno is set. Missed this in earlier
> revisions, sorry.

Will fix this in the next respin. Thanks for the review!

>
> > +       }
> > +
> > +       if (prog->type == BPF_PROG_TYPE_STRUCT_OPS) {
> > +               pr_warn("prog '%s': can't associate struct_ops program\n", prog->name);
> > +               return -EINVAL;
> > +       }
> > +
>
> [...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ