Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796278390; b=l389onpHe6zHFtirV0NsGsB8vA6c+BnzgOSt/PIDD6xWpt/aqZcEFrn8OvyJvwOtEsL9 2GZOm9/fAKDX7nfkqk3X48iIpIeldKrLEZScE/hyiLZ+9PeMmFNXS1xK8+kP2JejRP/JB 72q7ooj/WurnCImfmOLnZ6sdIZL8vZT6dSQT2Q4YOoIefjg0OAHelPHBYday1FUtHfAfx fae6joscBBFwp6395EXzsFJt4Z/j5jgNKXXmfw2xjUdx7iqZhvs7fCK6TE8tAwWAzZcJE qe+y00Xu0RWbhVTzkAIiZ/I1zj9lnXaPilRgJBh5j6G+ZrafAkB86a8zfXb2gHL22hg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796278390; 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:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=gDJf1oW8egxByI9Fu3P2b64OpG52ymIdMqH8X5R850o=; b=fxCM87ehQYJR1twE+72AvYtFAsF5esAJC/WV/iiWQ2xCcbnA3irhffYwsh1kk5L+VEin I9mpfMvxx5dkFisLw5v5LpcWPo3bQUbVNUA0SAExQUwdGYeG55P5+JPCOInLWpHCq2/Un TCSo7o7GfFufuIBDLkpW7IqOtFOjJ3Vhpyilxn3wgyDPMa0auEkcZ/grXWr4nLw3g4EJI 4MjUXdhD4UxIn1GiXYmrHitN0WrMOcTORSdAcnIJR+bdlV4jOSgddX9/0xcbZi2jq7zT8 qKxYKQtf4dTDx1zIRUqSrdZ9C9Er0E7Vo23Dn8h9aVd5HDazl0z31WJZ0ckxfD6iMcg== 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="wCse+s/e"; arc=none smtp.remote-ip=74.125.82.181 Received: from mail-dy1-f181.google.com (mail-dy1-f181.google.com [74.125.82.181]) (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 30629606A332 for ; Thu, 3 Dec 2026 06:13:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 30629606A332 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=wCse+s/e Received: by mail-dy1-f181.google.com with SMTP id 5a478bee46e88-38190551625so25732028eec.1 for ; Wed, 02 Dec 2026 22:13:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796278388; x=1796883188; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gDJf1oW8egxByI9Fu3P2b64OpG52ymIdMqH8X5R850o=; b=wCse+s/emPDO0Ad90hXSw0gA0zujaxWf7W9M3aiS14lmSBHT/4TSiALnWgCEYLeoyD 9t4SIMOblDZJC11qIDMYeWYFcDhg5hCw/nBCEJLkxxv5eFZGR9Sz4t0tdjPKf49XbHYx tNVzhsidwKsa8J7t8hGULY7ZdBgOMDuQvANKgmNvhJwAIuhh1ofHn2FpFj0+Deg1asA0 sr2yTIGKRqdodhDLOPl1MrgGxnkcsWNL5JoTjwV2o+jlf5OBDXF2jFitLdfaX7qF+fUc jyIob1nRhrd6QC8mfnMXKMULJpAyGj7GIKeiP8+aiT18r/fDgSm/zD/8i1yG87D2d0y+ d7iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796278388; x=1796883188; h=content-transfer-encoding:mime-version:references:in-reply-to :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=gDJf1oW8egxByI9Fu3P2b64OpG52ymIdMqH8X5R850o=; b=q40P2fEpTzGM/js/y/2vU4F9Gc+v+J6TeUaZ/sngXyZzACYSN4XwXWHfyReSvXipgU Xl8OcZ5Rzd2M6fbdpVgSIaUhejo5JMW1O4ZXAwF+DifD0Y6LRX2QJT/C/S9qTha/yzWk lYnQkjTgMygHXfFMCbPSL7aM1pe/uThITk695eE9S0CuD1qVeMqnSRKkOliIvj+0DGU1 tVvaUhfS31o63lrWjmIEAEc/bQ+xwU2iAJEd2DooG9jq5Zc8eqLfHvFM9NUa12S+sfU0 8JwO/DyxN5qaaydebo1uR65ht4bxYAn3A8dfsjGp9EnXvPM0p5EggfmKvCqd9e0gKe+N 12vw== X-Forwarded-Encrypted: i=1; AL+hErHURMlINvuqsKv3OvLHS8fEjU4oen6ydXDVyu1fd9BKBw7X5RBiRS5IOrFYSqXLbu9IDOw=@vger.kernel.org X-Gm-Message-State: APuU4Z+A/7XrjZi2of6VAnUuASTa3aD6UXhsy94DrVCHjaXIMGFYPLJC 0yQwPP12Gquh/mKNwyHBYVkw/Jz6pIv+aTnMDO6RhXgKJvu7EuWwxmAo X-Gm-Gg: AZFdTZewg2FiUNIR8L+nsod8UDXmxJjGxf/aZRUrOy1PR2BJrKCO2SGQZTha6w+s1e5 pRfdFGqF84bYi0gxzdRB1pMoLQISMXtm030oTFnRTB4OU0fa41pAFLsSDJGGBb+P5XhnEDEZDFe zqXRjtzb0RDgWFZ0qNQhKrR0sTeivlI/yxW4xlPKXvK2RZ6QcOCeDn7bCrZWU42ZZuJF4myAL9t +CVszE7so7HLHxrt5RZ503TtoObOD/dDbmI5FPAh1bMajYWyy3+5VKn3dIcuFo/K/UnozOfggD5 pmTThAUdRmjijAH/INJJuUa47ihYN9LZGQrR7aDeVGzDaS5Nj2ulyDugDBQhEFyvrvb1GvwgIy0 oDqA6Tq/muWP/zCSa1Hi1nrZCIaVaW5N68aK5fv37xPogS3xUmGqSkNz4UBgBzqGN2MltHVPfJu heSoym7Dgpw0Nn+5+n5XZrMhRfzhYaQeBrneoWy93OQBXCYQRcAT9YshUxSJebRdMG7cuXlxnlN hsFv42J5HN9uSvThqmUpB2B3KHLxSy2NMGpF/nOCKXqaNhCAinydGRRgRG5FacT8UCdTrn0QRXv FmgLcjIRtFdc7Or/CDf+r1DWTM/TZ9Jy0ZXaHG6hKMHe X-Received: by 2002:a05:7300:d508:b0:387:3f07:4869 with SMTP id 5a478bee46e88-3873f075a3dmr2803768eec.37.1796278388119; Wed, 02 Dec 2026 22:13:08 -0800 (PST) Received: from localhost.localdomain ([2406:7400:51:44ac:c2b6:f9ff:fe77:10a0]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38730405b61sm12074437eec.24.2026.12.02.22.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 22:13:07 -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, Amaan Cheval , 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 Message-ID: <20261203061215.487858-3-amaan.cheval@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20261203061215.487858-1-amaan.cheval@gmail.com> References: <20261203061215.487858-1-amaan.cheval@gmail.com> 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 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 --- 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