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:   Fri, 20 Mar 2020 13:24:45 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     John Fastabend <john.fastabend@...il.com>
Cc:     Jakub Kicinski <kuba@...nel.org>,
        Toke Høiland-Jørgensen <toke@...hat.com>,
        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>,
        "David S. Miller" <davem@...emloft.net>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        Lorenz Bauer <lmb@...udflare.com>,
        Andrey Ignatov <rdna@...com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH bpf-next 1/4] xdp: Support specifying expected existing
 program when attaching XDP

On Fri, Mar 20, 2020 at 11:31 AM John Fastabend
<john.fastabend@...il.com> wrote:
>
> Jakub Kicinski wrote:
> > On Fri, 20 Mar 2020 09:48:10 +0100 Toke Høiland-Jørgensen wrote:
> > > Jakub Kicinski <kuba@...nel.org> writes:
> > > > On Thu, 19 Mar 2020 14:13:13 +0100 Toke Høiland-Jørgensen wrote:
> > > >> From: Toke Høiland-Jørgensen <toke@...hat.com>
> > > >>
> > > >> While it is currently possible for userspace to specify that an existing
> > > >> XDP program should not be replaced when attaching to an interface, there is
> > > >> no mechanism to safely replace a specific XDP program with another.
> > > >>
> > > >> This patch adds a new netlink attribute, IFLA_XDP_EXPECTED_FD, which can be
> > > >> set along with IFLA_XDP_FD. If set, the kernel will check that the program
> > > >> currently loaded on the interface matches the expected one, and fail the
> > > >> operation if it does not. This corresponds to a 'cmpxchg' memory operation.
> > > >>
> > > >> A new companion flag, XDP_FLAGS_EXPECT_FD, is also added to explicitly
> > > >> request checking of the EXPECTED_FD attribute. This is needed for userspace
> > > >> to discover whether the kernel supports the new attribute.
> > > >>
> > > >> Signed-off-by: Toke Høiland-Jørgensen <toke@...hat.com>
> > > >
> > > > I didn't know we wanted to go ahead with this...
> > >
> > > Well, I'm aware of the bpf_link discussion, obviously. Not sure what's
> > > happening with that, though. So since this is a straight-forward
> > > extension of the existing API, that doesn't carry a high implementation
> > > cost, I figured I'd just go ahead with this. Doesn't mean we can't have
> > > something similar in bpf_link as well, of course.
> >
> > I'm not really in the loop, but from what I overheard - I think the
> > bpf_link may be targeting something non-networking first.
>
> My preference is to avoid building two different APIs one for XDP and another
> for everything else. If we have userlands that already understand links and
> pinning support is on the way imo lets use these APIs for networking as well.

I agree here. And yes, I've been working on extending bpf_link into
cgroup and then to XDP. We are still discussing some cgroup-specific
details, but the patch is ready. I'm going to post it as an RFC to get
the discussion started, before we do this for XDP.

>
> Would a link_swap() API (proposed by Andrii iirc) resolve this use case as
> well? If not why? If it can it seems like the more general and consistent
> solution. I can imagine swapping links is useful in tracing as well and
> likely other cases I haven't thought about.

Yes, that's the idea. Right now I have implementation for cgroups, but
API itself is generic and should/will be extended to tracing and XDP.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ