From: Amaan Cheval <amaan.cheval@gmail.com>
To: netdev@vger.kernel.org
Cc: joshwash@google.com, hramamurthy@google.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
sdf@fomichev.me, bpf@vger.kernel.org, willemb@google.com,
jeroendb@google.com, pkaligineedi@google.com, nktgrg@google.com,
jordanrhee@google.com, przemyslaw.kitszel@intel.com,
debarghyak@google.com, treapking@google.com,
Amaan Cheval <amaan.cheval@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH net 2/2] gve: do not pass extack to the XDP check on XSK pool setup
Date: Thu, 3 Dec 2026 11:42:15 +0530 [thread overview]
Message-ID: <20261203061215.487858-3-amaan.cheval@gmail.com> (raw)
In-Reply-To: <20261203061215.487858-1-amaan.cheval@gmail.com>
struct netdev_bpf only carries an extack for XDP_SETUP_PROG. For
XDP_SETUP_XSK_POOL, xp_assign_dev() fills in command, xsk.pool and
xsk.queue_id of an on-stack struct and nothing else, so xdp->extack is
whatever was on the stack.
Since commit 091a3b6ff2b9 ("gve: Use extack to log xdp config
verification errors") gve passes that pointer to
gve_verify_xdp_configuration(), which stores an error message through
it whenever the configuration is refused, for example when a zero-copy
socket is bound while the RX and TX queue counts do not allow XDP. With
CONFIG_INIT_STACK_ALL_ZERO the pointer is NULL and the message is
skipped; otherwise the driver writes to wherever the uninitialized
pointer points.
xp_disable_drv_zc() passes the same kind of struct when a pool is
disabled. gve ran the check on that path too until the commit "gve: do
not verify the XDP configuration on program or pool removal" removed
it, so a refused disable could also write through the pointer.
Pass NULL. The queue count refusal is still logged through
netdev_warn(); the other refusals are silent on this path.
Zeroing the struct in xp_assign_dev() and xp_disable_drv_zc() would
also fix this, and would cover idpf_xsk_pool_setup(), which reads
extack from it too. This patch fixes gve on its own so that the fix
does not depend on a change to the XSK core.
This was discovered by an AI code review agent reading gve_xdp() while
preparing "gve: do not verify the XDP configuration on program or pool
removal". It was reproduced, with that fix applied, on gVNIC in GQI-QPL
mode (GCE n2-standard-4) on net at commit ef3e21c61baa ("net/tcp-ao: fix
reset key lookup for IPv4 segments on IPv6 listeners"), built with
CONFIG_INIT_STACK_ALL_PATTERN, by binding a zero-copy AF_XDP socket at
the default queue counts and MTU 1460 with repro/xsk/xsk_trigger.c from
the Link below:
# ./xsk_trigger eth0 0
Oops: general protection fault, probably for non-canonical address 0xfefefefefefefefe: 0000 [#1] SMP NOPTI
RIP: 0010:gve_verify_xdp_configuration.cold+0x1d/0x2e [gve]
Call Trace:
gve_xdp+0x47/0x4d0 [gve]
xp_assign_dev+0x2c8/0x350
xsk_bind+0x1ba/0x4e0
With this patch the same bind is refused with -EINVAL and no fault.
Link: https://github.com/AmaanC/sticky-xdp
Fixes: 091a3b6ff2b9 ("gve: Use extack to log xdp config verification errors")
Cc: stable@vger.kernel.org
Signed-off-by: Amaan Cheval <amaan.cheval@gmail.com>
---
drivers/net/ethernet/google/gve/gve_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 5156259232b2..26b66a2c64b3 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -1868,7 +1868,8 @@ static int gve_xdp(struct net_device *dev, struct netdev_bpf *xdp)
if (!xdp->xsk.pool)
return gve_xsk_pool_disable(dev, xdp->xsk.queue_id);
- err = gve_verify_xdp_configuration(dev, xdp->extack);
+ /* xdp->extack is only valid for XDP_SETUP_PROG */
+ err = gve_verify_xdp_configuration(dev, NULL);
if (err)
return err;
return gve_xsk_pool_enable(dev, xdp->xsk.pool,
--
2.47.3
prev parent reply other threads:[~2026-12-03 6:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 6:12 [PATCH net 0/2] gve: fix XDP program and XSK pool removal after a config change Amaan Cheval
2026-12-03 6:12 ` [PATCH net 1/2] gve: do not verify the XDP configuration on program or pool removal Amaan Cheval
2026-12-03 6:12 ` Amaan Cheval [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203061215.487858-3-amaan.cheval@gmail.com \
--to=amaan.cheval@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=debarghyak@google.com \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=hramamurthy@google.com \
--cc=jeroendb@google.com \
--cc=john.fastabend@gmail.com \
--cc=jordanrhee@google.com \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nktgrg@google.com \
--cc=pabeni@redhat.com \
--cc=pkaligineedi@google.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sdf@fomichev.me \
--cc=stable@vger.kernel.org \
--cc=treapking@google.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox