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: <CAEf4BzbqneM9bXn646EpNAnaZr=sStqf6guBvWvf9qtyDYO9mg@mail.gmail.com>
Date:   Fri, 4 Dec 2020 11:31:37 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v6 bpf-next 10/14] bpf: allow to specify kernel module
 BTFs when attaching BPF programs

On Thu, Dec 3, 2020 at 5:54 PM Alexei Starovoitov
<alexei.starovoitov@...il.com> wrote:
>
> On Thu, Dec 03, 2020 at 12:46:30PM -0800, Andrii Nakryiko wrote:
> > +     if (attr->attach_prog_fd) {
> > +             dst_prog = bpf_prog_get(attr->attach_prog_fd);
> > +             if (IS_ERR(dst_prog)) {
> > +                     dst_prog = NULL;
> > +                     attach_btf = btf_get_by_fd(attr->attach_btf_obj_fd);
> > +                     if (IS_ERR(attach_btf))
> > +                             return -EINVAL;
> > +                     if (!btf_is_kernel(attach_btf)) {
> > +                             btf_put(attach_btf);
> > +                             return -EINVAL;
>
> Applied, but please consider follow up with different err code here.
> I think we might support this case in the future.
> Specifying prog's BTF as a base and attach_btf_id within it might make
> user space simpler in some cases. prog's btf covers the whole elf file.

The problem is that there is no link from BTF to bpf_prog. And
multiple instances of bpf_progs can re-use the same BTF object and the
same BTF type ID. That would need to be resolved somehow.

But keeping our options open is a good idea either way. So I'll send a
patch to switch this to -EOPNOTSUPP (I think that's the one we need to
use for user-space).

> Where prog_fd is a specific prog. That narrow scope isn't really necessary.
> So may be return ENOTSUPP here for now? With a hint that this might
> work in the future?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ