Skip to content

net: make xdp config checks effective vs netif_xdp_propagate()

Jakub Kicinski bpf linux-doc linux-kselftest netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 3 repliesApplied 5/5

Patches in v1 All 5 applied

#Subject and filesSizeRepliesApplied
1/5net: don't safety-check device features for XDP uninstallnet/core/dev.c+27 -211 replyApplied
2/5net: move dev_xdp_set_link() and dev_xdp_set_prog() upnet/core/dev.c+14 -140 repliesApplied
3/5net: record XDP programs propagated to lower devicesDocumentation/networking/net_cachelines/net_device.rst drivers/net/bonding/bond_main.c drivers/net/hyperv/netvsc_bpf.c +3 more+62 -61 replyApplied
4/5selftests/bpf: check XDP attach on a nested bond slavetools/testing/selftests/bpf/prog_tests/xdp_bonding.c+21 -30 repliesApplied
5/5selftests/bpf: check replacing and detaching XDP on a bond through a linktools/testing/selftests/bpf/prog_tests/xdp_bonding.c+96 -00 repliesApplied

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchStanislav Fomichev
SeriesA-b
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 0/5] net: make xdp config checks effective vs netif_xdp_propagate()

Bonding (and netvsc) try to auto-propagate XDP programs down to their lower devices. These programs were installed directly with .ndo_bpf and not recorded in struct net_device of the lowers. This makes all the config checks for features incompatible with XDP ineffective - HDS, memory providers etc. use dev_xdp_prog_count() and do not call down to the driver to ask it whether it has XDP installed.

Record the state appropriately. dev_xdp_prog_count() will now "see" the propagated programs.

The issue was discovered when reworking HW-GRO and XDP interactions. I was trying to make sure HW-GRO is reliably disabled with XDP, and discovered we have a way to bypass all checks with bonding. Not treating this as a fix since it's admin-only self-inflicted damage that nobody is reporting being bothered by in real life.

Jakub Kicinski (5):
net: don't safety-check device features for XDP uninstall
net: move dev_xdp_set_link() and dev_xdp_set_prog() up
net: record XDP programs propagated to lower devices selftests/bpf: check XDP attach on a nested bond slave selftests/bpf: check replacing and detaching XDP on a bond through a
link

 .../networking/net_cachelines/net_device.rst  |   1 +
 include/linux/netdevice.h                     |   7 +
 drivers/net/bonding/bond_main.c               |   4 +-
 drivers/net/hyperv/netvsc_bpf.c               |   2 +-
 drivers/net/hyperv/netvsc_drv.c               |   5 +-
 net/core/dev.c                                | 133 ++++++++++++------
 .../selftests/bpf/prog_tests/xdp_bonding.c    | 120 +++++++++++++++-
 7 files changed, 224 insertions(+), 48 deletions(-)
Signature · 1 line
2.56.0