gve: fix XDP program and XSK pool removal after a config change
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | gve: do not verify the XDP configuration on program or pool removaldrivers/ | +16 | 0 replies | |
| 2/2 | gve: do not pass extack to the XDP check on XSK pool setupdrivers/ | +2 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH net 0/2] gve: fix XDP program and XSK pool removal after a config change
gve checks that the device configuration supports XDP on every ndo_bpf call, including the ones that remove a program or disable an AF_XDP zero-copy pool. Once the MTU has been raised past the XDP limit, removal is refused, which the core does not expect: netlink removal fails, and a bpf_link release leaves the program running in the driver.
Patch 1 runs the check only when a program is installed or a pool is enabled. The bug was reproduced and the
fix tested on gVNIC in GQI-QPL mode (GCE n2-standard-4) on net and, as a backport, on Debian 13's 6.12.117, and in DQO-RDA mode (c3-standard-4) on net; reproduce.sh is at
https://github.com/AmaanC/sticky-xdp
The results on net were taken with both patches applied; patch 2 does not touch the removal paths. The 6.12.117 backport had patch 1 alone.
Patch 2 fixes a separate problem on the line patch 1 moves: the pool path passes an extack that is not valid for XDP_SETUP_XSK_POOL. It is latent with CONFIG_INIT_STACK_ALL_ZERO and was reproduced on a kernel built with CONFIG_INIT_STACK_ALL_PATTERN.
Other drivers avoid the first problem by running their checks only when a program is installed (mlx5, ice, veth), and by refusing an MTU change that an attached program cannot handle (those three, and i40e, ixgbe, igc). gve already refuses HW-GRO, header split and RX buffer size changes, and queue count changes that XDP cannot use, while a program is attached, but not an MTU change, and those guards do not cover a zero-copy pool that was enabled without a program: raising the queue counts then makes the pool disable fail in the same way. This series makes gve run its check only on install and pool enable, so that removal no longer depends on the configuration passing the XDP check.
Not changed by this series: gve still lets the MTU be raised past the XDP limit while a program is attached, and the GQI receive path runs the program only on frames that fit one buffer, so larger frames would reach the stack without it. That is a separate problem.
A removal can also still fail if gve cannot rebuild its queues in gve_adjust_config(), reached from gve_set_xdp(); that takes an allocation or device failure, not a configuration change, and is not addressed here.
Also not changed, both found by reading the code during review of this series and not reproduced:
- gve_xsk_pool_disable() unmaps the pool before it stops the queue, so a receive poll that is still running can use a pool whose device pointer has been cleared. That needs a separate fix.
- xp_assign_dev() and xp_disable_drv_zc() pass drivers an on-stack struct netdev_bpf that is not zeroed, and idpf_xsk_pool_setup() also reads extack from it. Zeroing it in the core would cover every driver; patch 2 fixes gve on its own and does not depend on that.
Both were found with the help of an AI coding assistant, used interactively to read the driver and the XDP core, write the reproducers and run the tests; details are in each patch.
Amaan Cheval (2):
gve: do not verify the XDP configuration on program or pool removal
gve: do not pass extack to the XDP check on XSK pool setup
drivers/net/ethernet/google/gve/gve_main.c | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
base-commit: ef3e21c61baa74e39a49b75318bd4541562ec43f
Signature · 1 line
2.47.3