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: <CAADnVQLzrWVfgSogXpOm3F1TZF5jxDoQD+VsS4mQVAkEkNjNwA@mail.gmail.com>
Date:   Fri, 5 Jun 2020 10:01:12 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Toke Høiland-Jørgensen <toke@...hat.com>
Cc:     Jesper Dangaard Brouer <brouer@...hat.com>,
        David Ahern <dsahern@...il.com>, bpf <bpf@...r.kernel.org>,
        Network Development <netdev@...r.kernel.org>,
        Daniel Borkmann <borkmann@...earbox.net>,
        Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Lorenzo Bianconi <lorenzo@...nel.org>,
        David Miller <davem@...emloft.net>
Subject: Re: [PATCH bpf-next V1] bpf: devmap dynamic map-value area based on BTF

On Fri, Jun 5, 2020 at 4:01 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> Jesper Dangaard Brouer <brouer@...hat.com> writes:
>
> > On Thu, 4 Jun 2020 10:33:41 -0700
> > Alexei Starovoitov <alexei.starovoitov@...il.com> wrote:
> >
> >> On Thu, Jun 04, 2020 at 10:40:06AM -0600, David Ahern wrote:
> >> > On 6/4/20 9:48 AM, Jesper Dangaard Brouer wrote:
> >> > > I will NOT send a patch that expose this in uapi/bpf.h.  As I explained
> >> > > before, this caused the issues for my userspace application, that
> >> > > automatically picked-up struct bpf_devmap_val, and started to fail
> >> > > (with no code changes), because it needed minus-1 as input.  I fear
> >> > > that this will cause more work for me later, when I have to helpout and
> >> > > support end-users on e.g. xdp-newbies list, as it will not be obvious
> >> > > to end-users why their programs map-insert start to fail.  I have given
> >> > > up, so I will not NACK anyone sending such a patch.
> >>
> >> Jesper,
> >>
> >> you gave wrong direction to David during development of the patches and
> >> now the devmap uapi is suffering the consequences.
> >>
> >> > >
> >> > > Why is it we need to support file-descriptor zero as a valid
> >> > > file-descriptor for a bpf-prog?
> >> >
> >> > That was a nice property of using the id instead of fd. And the init to
> >> > -1 is not unique to this; adopters of the bpf_set_link_xdp_fd_opts for
> >> > example have to do the same.
> >>
> >> I think it's better to adopt "fd==0 -> invalid" approach.
> >> It won't be unique here. We're already using it in other places in bpf syscall.
> >> I agree with Jesper that requiring -1 init of 2nd field is quite ugly
> >> and inconvenient.
> >
> > Great. If we can remove this requirement of -1 init (and let zero mean
> > feature isn't used), then I'm all for exposing expose in uapi/bpf.h.
>
> If we're going to officially deprecate fd 0 as a valid BPF fd, we should
> at least make sure users don't end up with such an fd after opening a
> BPF object. Not sure how the fd number assignment works, but could we
> make sure that the kernel never returns fd 0 for a BPF program/map?
>
> Alternatively, we could add a check in libbpf and either reject the
> call, or just call dup() before passing the fd to the kernel.

Tweaking libbpf to do dup() was on our todo list for some time.
I think it would be good to do it both in the kernel and in the libbpf.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ