Thread (11 messages) read the whole thread 11 messages, 4 authors, 2020-03-25

Re: [PATCH bpf-next v3 1/4] xdp: Support specifying expected existing program when attaching XDP

From: Jakub Kicinski <kuba@kernel.org>
Date: 2020-03-24 19:40:20
Also in: bpf

On Tue, 24 Mar 2020 19:12:53 +0100 Toke Høiland-Jørgensen wrote:
From: Toke Høiland-Jørgensen <redacted>

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.

Signed-off-by: Toke Høiland-Jørgensen <redacted>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>

Thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help