Thread (8 messages) flat view 8 messages, 3 authors, 6d ago

Re: [PATCH bpf-next v4 2/3] bpf, xdp: move offload check into dev_xdp_install()

From: Jiayuan Chen <jiayuan.chen@linux.dev>
Date: 2026-08-11 03:07:07
Also in: bpf, linux-kselftest, lkml

On 8/11/26 2:49 AM, Jakub Kicinski wrote:
On Mon, 10 Aug 2026 13:06:00 +0800 Jiayuan Chen wrote:
quoted
bpf_xdp_link_update() calls dev_xdp_install() directly and skips
dev_xdp_attach(), so the checks in dev_xdp_attach() do not run. A user can
make an XDP link with a normal program and then swap in an offloaded or
device-bound program with BPF_LINK_UPDATE, which puts it on the software
path.

Move the three program checks (offloaded, bound to another device, and
device-bound in generic mode) from dev_xdp_attach() into
dev_xdp_install(), so both the attach path and the link update path are
covered.
Shouldn't we move all the checks that are not explicitly about the
netlink API (so all but the first?)
Sounds great, the code would be much cleaner.

It may be better to split the series and send this patch to net,
the netdev CI has a netdevsim test for the prog offload, would be
good to run that.

Though for now bpf_xdp_link_update() already does:

     if (old_prog->type != new_prog->type ||
         old_prog->expected_attach_type != new_prog->expected_attach_type) {
         err = -EINVAL;
         goto out_unlock;
     }

so the other checks can't be triggered on the update path even without 
them in dev_xdp_install().


So I'm thinking this patch works as a standalone fix (good for 
backport), and the cleanup goes as a followup (if necessary)?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help