From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796365759; b=ivMP8MkJ2YcsTd5HbEB2DWW7MiqktmHbKSCzfEYWasFpRYL6OJLGD7ShtvP916w2L6jt pI8KeamxhaKOxX4F3PJ0DGUCaQUA4lSE8OnhsNsDRRCdlboNmq4U/CTgoiPhuscPeVajt MiepiGgodDvkl0AvI/VHAagQ4dNpYARzGt3QlV9fBRw0sFpE0dlokyfoxxAbgj6kgLyWT ikLsAVvqXVhR+lkJt4uO8mqjPYDi7qFlWf5eEDNW5jrHX9fSQDbzYX/Cryak2pQXI5Js8 mwYB2zR66T53Uo/R4WJ+dmz3TMIuc1pppfUt0OyvwVgYTrT+NZeH62Wmllak8ezPf/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796365759; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=vyvooAG8bEPptQqwokU9ZoWaTZr2IOMX9Psd0cbAPWo=; b=jC6btA7oayyu1rbWNXFCVxJ4HLypsM/N0ntEdCPDqg1DPK9VcN0/jbUZrnI1+f6hKSXs aL3m9NeOdC0oyC31o3Nr94mT9fCYHPiV3Sw/xBAAmXu+5OLIKyY2YMs9j4CKMV5ywErwr M8XJyLLbPIPB6RRftwsHtk6cZ2w/p7L+uPxbQ8Bh18R4Ihh2kP8GyCMGerz71m734m7OP g7lyZmrS3Rvj0/bZkJrdzfv9mk2+ftHfjoO+OxE/p3IE12DB1Fw6+J6dOkVkihH+eLZcl dWYU74jXHL1GPgm1Bb383qstmvHEwJatDLhY1QzveWyDbetmXafa4GBsngvgT12HIGw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=x5NSPuzf; arc=none smtp.remote-ip=74.125.82.54 Received: from mail-dl1-f54.google.com (mail-dl1-f54.google.com [74.125.82.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76383606A32C for ; Fri, 4 Dec 2026 06:29:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 76383606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=x5NSPuzf Received: by mail-dl1-f54.google.com with SMTP id a92af1059eb24-1b5d5df1f13so337856c88.0 for ; Thu, 03 Dec 2026 22:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796365758; x=1796970558; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=vyvooAG8bEPptQqwokU9ZoWaTZr2IOMX9Psd0cbAPWo=; b=x5NSPuzfBGDeguZwDGmI1AHLIjHSQOU3lPrh2VAR3iuuq+cFEM7lbyx27zjzv3cqef IXWRJDI2y1ZyTz/iDn79SqFhFySHNZICIdcjXkNmmEuhNfIcda7qoyQjRQ0rKUqqaNt0 aDHnmghDNivyw3w9tGNNDOnF6omMka2z21XTFMpOBhvl1KVCWsZ1T9Xg6kA2ndZOqbpP VmwbHBZTljSHiH2F8OlD8+n+tsv2e1ZMDF90dki5d/tVg0QeoIZ4rM2X2/DxL41vmsTi Ienh7XhQi2tfTSR8TNUn92Wa8uFF3F4V1TquAK4pKKn8sZGyQjlkpGeg3RNRo0JPLqT4 qc3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796365758; x=1796970558; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=vyvooAG8bEPptQqwokU9ZoWaTZr2IOMX9Psd0cbAPWo=; b=xLXSN/dWRk2p35D2LOFeRFCLCeSyvxCd4wEAke6dkW2Vrm3PvWhpgZqyv5dcQvljbt R6u9wgjMI6ocf67KvMyE2+6F2fsAdtWEYd4495Mv8F6GRZgeHIcwTc9GP6xqYC7CKnN2 1fl9o7SNQS+5NzR+gktWOOX3JjvxrFUQ0HpSvVsgmQ5YpRqSRhiV36aA16kT51Cbwry3 wQWTdjTa5fyCEbbUxpoZmEdaWudjshqAislZ+kOxka3/pBJsPV6gUibfhRbzvjVKVpyw scqJWxYh9vp1g4MlHgOu/EZbzokkfbfCRuOKXWq9DYopnO0lR2toRUoWswEuMfjHaqOM +haw== X-Forwarded-Encrypted: i=1; AL+hErGLVSd0A9y0TZVcOwK4crd/pbJKEoTU4vt0GD0chLDzJJziFBfmGJZ52RjkWYmw8KXwXPU=@vger.kernel.org X-Gm-Message-State: APuU4Z/cAh5aM0SHbaX8rplGEcbDMnrmgaDIbdOWafxBQWoGBiGqEUxd 3jeFf7LwlEVxh2dbhy+EnRl2d4EQ3ruoSx9+ZTtNM/M4y1WR/QzJqT2/ X-Gm-Gg: AZFdTZfRD3OpfDFdY2reYeWpNhDV2DVT9gsm+N80rlJh7TZ7zsbeZG/nf+G0jy7usZC Ak+8h7nNTJqpQrJjeTS44M8Ng9yNR1mP8ull79tYANAIRuxQ1fwbSEdU1iBCeSaFuVVzbxltfQM qZargV2b48QEnssDO+q242gr+BeB/fviPukN/KMCnLdALiacTR7tOlS4wdE4a/RXIiQuEIRKtbL t0PqcgvGxkL8SglJeH4Wlg4kmQJowwa+v5tJIAutjXuR7YxoYm4VYGMnPSgjFZFBK7Na7cMCc9z ciUvg30PBGzljgpQpCkvJyZo8AVLnKvuACQeaROZ7UpWLK4zy5a+rPMXK65AP8C6Yy8TFCo4oir xSzfjTixmutv3uz40P5m7WQSt46Gu/H6nWsjFk7WTb1RKFBxvEtyvVqssz1jzkM4jKWsl2HD7BS i+RCR2xF42++wQCQfn2Adu8HXH3CRQ6vn4YmO8YNiHdJItD/TIsFZB1uIsBZ/XDsEWgjVg8l7Ok tt31vPw8JIsODr8ChUOuTpZARrGSb7PO4/HKHKF7mOxO69s2C2u9H+dwbhOLp3YvFg9MZC3mo/s nOAIx/h9GAoExVlUH5a6SZskZeCKhTX7ySGe9vOEU4wiq2a+OqZAlManxuS5VvLWng== X-Received: by 2002:a05:7022:ea8d:b0:1b5:8265:33a7 with SMTP id a92af1059eb24-1b5d7115820mr1188548c88.17.1796365758471; Thu, 03 Dec 2026 22:29:18 -0800 (PST) Received: from localhost.localdomain ([2406:7400:51:44ac:c2b6:f9ff:fe77:10a0]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5d63d04e7sm4447866c88.1.2026.12.03.22.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 22:29:18 -0800 (PST) From: Amaan Cheval 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, magnus.karlsson@intel.com, maciej.fijalkowski@intel.com, horms@kernel.org, michal.kubiak@intel.com, anthony.l.nguyen@intel.com, aleksander.lobakin@intel.com, Amaan Cheval Subject: [PATCH net v2 0/2] gve, xsk: fix XDP removal after a config change and an uninitialized extack Date: Fri, 4 Dec 2026 11:58:55 +0530 Message-ID: <20261204062857.730993-1-amaan.cheval@gmail.com> X-Mailer: git-send-email 2.49.0 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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