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:   Tue, 24 Mar 2020 18:43:11 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Toke Høiland-Jørgensen <toke@...hat.com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        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>,
        John Fastabend <john.fastabend@...il.com>,
        Lorenz Bauer <lmb@...udflare.com>, Andrey Ignatov <rdna@...com>
Subject: Re: [PATCH bpf-next v3 1/4] xdp: Support specifying expected
 existing program when attaching XDP

On Tue, 24 Mar 2020 17:54:07 -0700 Andrii Nakryiko wrote:
> On Tue, Mar 24, 2020 at 11:13 AM Toke Høiland-Jørgensen <toke@...hat.com> 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_ID, 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.
> > Setting the new attribute with a negative value means that no program is
> > expected to be attached, which corresponds to setting the UPDATE_IF_NOEXIST
> > flag.
> >
> > A new companion flag, XDP_FLAGS_EXPECT_ID, is also added to explicitly
> > request checking of the EXPECTED_ID attribute. This is needed for userspace
> > to discover whether the kernel supports the new attribute.  
> 
> Doesn't it feel inconsistent in UAPI that FD is used to specify XDP
> program to be attached, but ID is used to specify expected XDP
> program? Especially that the same cgroup use case is using
> (consistently) prog FDs. Or is it another case where XDP needs its own
> special way?

There was a comment during review of v1, I wish you spoke up then.

The prog ID is what dump returns, so the consistency can go either way
(note that this API predates object IDs). Since XDP uses IDs internally
it's just simpler to take prog ID.

But it's a detail, so if you feel strongly I don't really mind.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ