Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] gve, xsk: fix XDP removal after a config change and an uninitialized extack
@ 2026-12-04  6:28 Amaan Cheval
  2026-12-04  6:28 ` [PATCH net v2 1/2] gve: do not verify the XDP configuration on program or pool removal Amaan Cheval
  2026-12-04  6:28 ` [PATCH net v2 2/2] xsk: initialize the struct netdev_bpf passed to ndo_bpf Amaan Cheval
  0 siblings, 2 replies; 4+ messages in thread
From: Amaan Cheval @ 2026-12-04  6:28 UTC (permalink / raw)
  To: netdev
  Cc: joshwash, hramamurthy, andrew+netdev, davem, edumazet, kuba,
	pabeni, ast, daniel, hawk, john.fastabend, sdf, bpf, willemb,
	jeroendb, pkaligineedi, nktgrg, jordanrhee, przemyslaw.kitszel,
	debarghyak, treapking, magnus.karlsson, maciej.fijalkowski, horms,
	michal.kubiak, anthony.l.nguyen, aleksander.lobakin, Amaan Cheval

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 GQI-QPL reproduce.sh run on net was repeated with the two patches of
this version applied. The DQO-RDA and pool disable results are from v1's
kernel, which had patch 1 and v1's gve change to the pool path; that
change did not touch the removal paths. The 6.12.117 backport had patch
1 alone. In all of the above, net is at
commit ef3e21c61baa ("net/tcp-ao: fix reset key lookup for IPv4
segments on IPv6 listeners"), the base of this series.

Patch 2 fixes a separate problem that gve hits on the line patch 1
moves: the XSK core passes drivers a struct netdev_bpf whose extack is
not initialized, and gve and idpf read it. It is latent with
CONFIG_INIT_STACK_ALL_ZERO and was reproduced on gve 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, 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.

That problem and the one patch 2 fixes 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.

v2:
- Patch 2 now initializes the struct in the XSK core, in xp_assign_dev()
  and xp_disable_drv_zc(), and replaces v1's gve-only change (Maciej).
- Patch 1 is unchanged.
v1: https://lore.kernel.org/netdev/20261203061215.487858-1-amaan.cheval@gmail.com/

Amaan Cheval (2):
  gve: do not verify the XDP configuration on program or pool removal
  xsk: initialize the struct netdev_bpf passed to ndo_bpf

 drivers/net/ethernet/google/gve/gve_main.c | 22 ++++++++++++++++------
 net/xdp/xsk_buff_pool.c                    |  4 ++--
 2 files changed, 18 insertions(+), 8 deletions(-)


base-commit: ef3e21c61baa74e39a49b75318bd4541562ec43f
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-04 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  6:28 [PATCH net v2 0/2] gve, xsk: fix XDP removal after a config change and an uninitialized extack Amaan Cheval
2026-12-04  6:28 ` [PATCH net v2 1/2] gve: do not verify the XDP configuration on program or pool removal Amaan Cheval
2026-12-04  6:28 ` [PATCH net v2 2/2] xsk: initialize the struct netdev_bpf passed to ndo_bpf Amaan Cheval
2026-12-04 18:07   ` Maciej Fijalkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox