๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14484

Re: [PATCH net v5 1/2] gve: refuse XDP on queue formats without XDP support

#14484
From: netdev-bot+sashiko
Date: Wed, 11 Nov 2026 10:06
151 lines
13945 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 (1) ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message misstates which queue formats the new check
  affects.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch
  extends it.

--

gve: refuse XDP on queue formats without XDP support

This patch adds a check to gve_verify_xdp_configuration() that refuses XDP
setup when dev->xdp_features lacks NETDEV_XDP_ACT_BASIC. It replaces the
queue format gate dropped by commit d8a8ca14c937. The aim is to keep XDP
off DQO-QPL, whose RX page accounting can free a page that is still
DMA-mapped and registered in the QPL.

> Refuse XDP setup in gve_verify_xdp_configuration() whenever the driver
> advertises no XDP features for the current queue format, which today
> means DQO-QPL.

[Severity: Medium]
Is "which today means DQO-QPL" accurate? gve_set_netdev_xdp_features() only
sets NETDEV_XDP_ACT_BASIC for GQI-QPL and DQO-RDA:

drivers/net/ethernet/google/gve/gve_main.c:gve_set_netdev_xdp_features() {
	if (priv->queue_format == GVE_GQI_QPL_FORMAT) {
		xdp_features = NETDEV_XDP_ACT_BASIC;
		...
	} else if (priv->queue_format == GVE_DQO_RDA_FORMAT) {
		xdp_features = NETDEV_XDP_ACT_BASIC;
		...
	} else {
		xdp_features = 0;
	}
	...
}

GQI-RDA also falls into the else branch. gve_adminq.c can still select
GVE_GQI_RDA_FORMAT from the GQI_RDA and GQI_RAW_ADDRESSING device options,
so the new check refuses GQI-RDA as well.

The check that d8a8ca14c937 removed (queue_format != GVE_GQI_QPL_FORMAT)
also refused GQI-RDA. Since that commit, XDP could be attached on GQI-RDA,
and XDP_TX there takes this path:

gve_rx()
  gve_xdp_done()
    gve_xdp_xmit_one()
      gve_tx_fill_xdp()

gve_tx_fill_xdp() always uses tx->tx_fifo: it calls gve_tx_alloc_fifo(),
memcpy()s into tx->tx_fifo.base and reads tx->tx_fifo.qpl->page_buses. A
raw-addressing TX ring never allocates that FIFO. Isn't that a NULL
dereference that this patch also fixes without saying so?

Could the commit message mention GQI-RDA? Two things are worth stating:
GQI-RDA now gets -EOPNOTSUPP, and this closes the XDP_TX crash there. That
would help stable backporters.

The follow-up patch "gve: fix RX page refcount overflow from INT_MAX
pagecnt_bias" uses the same wording ("The previous patch keeps it that way
by blocking XDP on DQO-QPL"). Its safety argument also depends on XDP being
blocked on GQI-RDA.

> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 2437cd8ba6331..fe560f5c5408c 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -1723,6 +1723,12 @@ static int gve_verify_xdp_configuration(struct net_device *dev,
>  	struct gve_priv *priv = netdev_priv(dev);
>  	u16 max_xdp_mtu;
>  
> +	if (!(dev->xdp_features & NETDEV_XDP_ACT_BASIC)) {
> +		NL_SET_ERR_MSG_MOD(extack,
> +				   "XDP is not supported on this queue format.");
> +		return -EOPNOTSUPP;
> +	}
> +

[Severity: High]
This is a pre-existing issue that this patch did not introduce, but the
patch adds another exit to the same gate. gve_xdp() calls
gve_verify_xdp_configuration() before it looks at the command, so the gate
also runs for teardown:

drivers/net/ethernet/google/gve/gve_main.c:gve_xdp() {
	err = gve_verify_xdp_configuration(dev, xdp->extack);
	if (err)
		return err;
	switch (xdp->command) {
	case XDP_SETUP_PROG:
		return gve_set_xdp(priv, xdp->prog, xdp->extack);
	case XDP_SETUP_XSK_POOL:
		if (xdp->xsk.pool)
			...
		else
			return gve_xsk_pool_disable(dev, xdp->xsk.queue_id);
	...
}

Several of the gate's conditions can become true after a successful bind:

- gve has no ndo_change_mtu, so the MTU can be raised above max_xdp_mtu
  while a zero-copy pool is bound.
- gve_set_features() refuses HW-GRO only when priv->xdp_prog is set, so
  HW-GRO can be turned on while only a pool is bound.
- The queue counts can be changed the same way.

When the AF_XDP socket is then closed:

xp_release_deferred()
  xp_clear_dev()
    __xp_clear_dev()
      xp_disable_drv_zc()
        gve_xdp()
          gve_verify_xdp_configuration()   /* returns -EOPNOTSUPP */

On failure, xp_disable_drv_zc() only does WARN(1, "Failed to disable
zero-copy!\n"). The core then goes on to xsk_clear_pool_at_qid(),
xdp_put_umem() and xp_destroy().

Because gve_xsk_pool_disable() never runs, clear_bit(qid, priv->xsk_pools),
xsk_pool_dma_unmap() and gve_unreg_xsk_pool() are all skipped. Won't
rx->xsk_pool and tx->xsk_pool still point at the freed pool when the RX
refill and XSK TX NAPI paths use them? The UMEM DMA mappings would also be
leaked.

dev_xdp_uninstall() follows the same pattern for programs. It does WARN_ON()
on the failed removal and then calls bpf_prog_put(), which leaves
priv->xdp_prog dangling.

The new xdp_features check cannot change between setup and teardown by
itself, since gve_setup_device() computes it only from queue_format. Even
so, would it be better to run the verification only for XDP_SETUP_PROG with
a non-NULL prog and for pool enable, so that teardown is never refused?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261109100437.331423-1-amaan.cheval%40gmail.com
Technical Details
Message-ID: <179439161258.2199510.10096207449822395421@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360982-linux-kernel-netdev=dewy.ru
References: <20261109100437.331423-2-amaan.cheval@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360982-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 1/2] gve: refuse XDP on queue formats without XDP support
Date: Wed, 11 Nov 2026 10:06:52 +0000
Organization: Usenet Network
Message-ID: <179439161258.2199510.10096207449822395421@kernel.org>
References: <20261109100437.331423-2-amaan.cheval@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="826682"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Cb/fDiZlXVyxGA3euMfUri15e3I= sha256:u2AnRIbUw+BKOqzXnl/BoSYzRdyoS2Mt+UEtNa6C+Fg=
	sha1:TdOO802bqbS0ERfWxhxgLYtkAEg= sha256:FgRGHvnK5Gf5edo9fhB++oncJvN78fgMvA8bpObsiZY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 523B0113E9A; Wed, 11 Nov 2026 13:07:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id D_m1F2DniUqj;
	Wed, 11 Nov 2026 13:07:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-360982-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id F315D113E94; Wed, 11 Nov 2026 13:07:45 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 8866244DD2; Wed, 11 Nov 2026 10:07:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794391620;
	b=x1xvFI28d3H7tPEVpI0yqAo/4RQ3DxNkTvheUa08bRTNsVpMiQJ4dH5Y7dIUinYYOuVo
	 Hezk8U5bsIsQs5zvgwyWwD5pxud7EkP5sosPcxo+I98N0HxZXgNV/Ia4NP66CooEb9n1D
	 NThrXIZfsvMongXyd5px4TVMBJZ3N38KGHXd3p59d88W1C/Q/ps14A3BZid8GoB3qkWjT
	 rAp5ig8xnvULSyZkHxfGIM7Q6DUQQT/qyHpGXaR0PAEaDP5kkiCwQ1v5ChceWn/sVgEkV
	 O56bhg8AA36IVLLA69Bxosh8O8eRS6pSHn9QfLptAOwxfNhes+T6+BrSNTtx256d13A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794391620;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=VlfbgDgQAEitsNSmJqDXQTJdALRr6On/NT0I0OmkIfA=;
	b=rEnZxFGsRZ7oQf8ldxaacpWKJQWepw/B1+eBzp4G94D1GFEty9U2gN39tJaTqT1nnfn5
	 GcRHjy/w1cMHkm7BYhMIgVXPMZKRxTzxy5O0HfQcALfUqF2DEXWkmyZiBJdILFy+GGL7W
	 ShxGM8rX/7wkoZDdToXuLnsIrySr2gCvjlQ6L46qsATQ9WXdmB17oNorHucPZZyobCWD/
	 eN5KSHD7nIs7BVC88Th1NYzoulAxP/LkYUV/eWk1rvZlCKVh8IEmoKdDW6Ah171jOtNtM
	 hyyYtrAZSQQtib2O8UrPmcf06KIGk2DPtLr8N6osPf6/o9ZQMazjrgqlzF2bbtPqiNw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=e4p588Da;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id D5FD3606A321;
	Wed, 11 Nov 2026 10:07:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=e4p588Da
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794391615;
	b=XMrEzI83yHCzh30cMmtTpxPlgSuygM2NZLN2JqUshNGnrsBtYgbnRz7RIwTtK9AgmyLV
	 TBslmcp72bs5HqJGJbWwxGVp9RMsH83pdpIYQkX5o8KEqoaeftLfEszsS2vy5/ckKpMIe
	 gagZFD6eOk6Trx8P0Hey/a4nR11SPEDwnxlKckrSze2f4i7igIxmPGA5e6uKdflZ+CIcE
	 Y/VSQ1oM9kV6GrIdqe3ewawKX9/HCc6nQ9TyWoBKWREIDixaP2q3bHH9mzY3+zX6jGGFa
	 /FreNAfr7gMt6DmA3Ze2D70utV75EPLpDcKqy1TWfsBRmuZiXkvZK/kE5tB4ilHn2aw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794391615;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=VlfbgDgQAEitsNSmJqDXQTJdALRr6On/NT0I0OmkIfA=;
	b=J3jIlMt9+DTOlwyRu76iiU9YMEa5dZlLw+MC3VYu78VIy8jN6mPeIW0iB0f260US4p4F
	 JgeyWX62Z7Xb4i4yEiidBkGF3vYZ1mBnOUUYmx1igPdJ1qonrlnOtqfN9MqGb8zPtIfh6
	 r/7DGNWrbZlhiyhdHmtE81IqAsvOHmJeG3WmgbZCmaU6ysMH8OpvhKz/ecsJzzQD/0c/2
	 MbAZ+Fui2J/o9BSnYRJKoSJA5Zsh2qYCdaNLMJ4uFRgCKbWeUdUrEid1XRXv+47WV6TX+
	 hvRjTmUka94U0HsFH/osA+944m/PAAy9uQoyK/wPfrgSHpEKRr3HE6RZwYEyGUPbD6A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=e4p588Da;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F23CB606A333;
	Wed, 11 Nov 2026 10:06:54 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1598C1F00A05;
	Wed, 11 Nov 2026 10:06:53 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794391614;
	bh=VlfbgDgQAEitsNSmJqDXQTJdALRr6On/NT0I0OmkIfA=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=e4p588Da+7AjF2uWURuees2FVLx9OHEFnt6AQUUn5ItfCjASqQlduuuqtghPqvLbf
	 wtl8MByo8ihpgEWCT1D1I/sHb1uCZ1/kCPfeaPIz7RiB1kYYwfFq8y5kNmkLgQozk0
	 WtQ9nqzBEuERWQ4hwEoOo/T/SU3+KMDkcGok88Mj+nbLg5kr5tUE57aoTQQbR91WcL
	 qlc+n91Qdwqgv1EnX3JA5B/KGqtsYfsnrIqBmOzSYjCFs/2QEZt6WHyae4SahsIxEB
	 yiP9T4qCJhko56XnxlOdxTHwM5tRhHu+snaXEQnhyOmKHdxwWHGMsDGfn6Pyi2Tibn
	 JWvxrtCyr7q7A==
X-Cc: netdev@vger.kernel.org, joshwash@google.com, hramamurthy@google.com,
 andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, bcf@google.com, jordanrhee@google.com,
 przemyslaw.kitszel@intel.com, maciej.fijalkowski@intel.com,
 pkaligineedi@google.com, maolson@google.com, csully@google.com,
 willemb@google.com, yangchun@google.com, npl@google.com,
 awogbemila@google.com, shailend@google.com, nktgrg@google.com,
 maxyuan@google.com, bpf@vger.kernel.org, john.fastabend@gmail.com,
 hawk@kernel.org, sdf@fomichev.me, daniel@iogearbox.net, ast@kernel.org,
 linux-kernel@vger.kernel.org, stable@vger.kernel.org
X-In-Reply-To: <20261109100437.331423-2-amaan.cheval@gmail.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list