From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC72ECA6012 for ; Fri, 9 Oct 2026 08:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1jl9tQJWjV8nksZpR7yDPWHvqkEBuwYygti9sXjrMe4=; b=tKVK3j8LXcuNi6X2GhETegPEm/ nA/tch0TP9ua4HzsLXlhMvqrY7dp9MavpzxQ0XmcZYH0PBNEtpkO4W+RcI9mapzJ4G5WSaD6rxYs8 t1UTBaY0YuNs+c+Uy9Xh78Ii34D3xepzfPihnBw0vJeTjzy58MN0/Xmpx66yn+kr/fzOjrHVMl7VZ xGD7hi9OykRZU5Y5jBb8pXUP8CCFhQmJHK2NKwBo89+uIPXSSSVssutSpt1WSQOUhkfkI0qS1JFui vGWcQwyA5rG+wanX4oKoyS1+brJTTwGcJ+bKvG7WE3st0amTgiQS/yTFri5bNy+CaVS+uGThy7AG5 d5NXl6DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xF66k-00000005pfc-1a1n; Fri, 09 Oct 2026 08:37:38 +0000 Received: from mail.tipi-net.de ([2a03:4000:43:185::1]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xF66g-00000005pf1-30ck for linux-arm-kernel@lists.infradead.org; Fri, 09 Oct 2026 08:37:36 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7B591A1561; Fri, 9 Oct 2026 10:37:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1791535049; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=1jl9tQJWjV8nksZpR7yDPWHvqkEBuwYygti9sXjrMe4=; b=x9O41IoiaA1sMC21CzEWXcQnk55P4GigN1uHSPsC+Xtwt2d2EL0M+tos8ltfSemhW41AK8 kD003tpHzLnlGAegyXUbN/wPwAvt5fhftLLFE1jpRbTjZ603yJsSal9NWqgvUuMItqT+Or /PXjWcCZmvj46iJ7m6LuI7uTgvFIiRrtHN2OIasf3FdXGqof8nYskGFaSVHJeRch8pUA2X csndNPDuhOhHJdEQCT5AmFngKcWovukqFeQbTXLnGqMcH5pNpjrQWs5vvUANXIVUxt5BUT 30y71+BxBLLKuTrz85C71kghZPYenrZsTHCT0czszyn7iHFlU8KUC+L6PXmquQ== MIME-Version: 1.0 Date: Fri, 09 Oct 2026 10:37:26 +0200 From: Nicolai Buchwitz To: netdev-bot+sashiko@kernel.org Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, o.rempel@pengutronix.de, maxime.chevallier@bootlin.com, andrew+netdev@lunn.ch, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, Jose.Abreu@synopsys.com, saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com, leon@kernel.org, dtatulea@nvidia.com, alazar@nvidia.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH net-next 3/3] net/mlx5e: use skb_share_check() in the loopback selftest hook In-Reply-To: <179149509264.434549.15492783775949444420@kernel.org> References: <20261007-nb-net-selftest-shared-net-v1-3-458369bfa1ba@tipi-net.de> <179149509264.434549.15492783775949444420@kernel.org> Message-ID: X-Sender: nb@tipi-net.de Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261009_013735_241611_FB209BCD X-CRM114-Status: GOOD ( 19.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 8.10.2026 23:31, netdev-bot+sashiko@kernel.org wrote: > [...] > [Severity: Low] > This isn't a bug, but the comment just below this hunk in > mlx5e_test_loopback_validate() now contradicts the new code: > > if (skb_linearize(skb)) > goto out; > > /* We are only going to peek, no need to clone the SKB */ > if (MLX5E_TEST_PKT_SIZE - ETH_HLEN > skb_headlen(skb)) > goto out; > > skb_share_check() calls skb_clone() whenever the skb is shared. After > that, skb_linearize() can modify or reallocate the skb head. > > Should this comment be dropped or reworded? A later reader could take > "no need to clone" at face value and remove the skb_share_check(). > stmmac_test_loopback_validate() uses the same skb_share_check() + > skb_linearize() sequence and has no such comment. Yes, it is stale. I'll drop it if a v2 is needed. > [...] > [Severity: Low] > This is a pre-existing issue and was not introduced by this patch. > Further down in mlx5e_test_loopback_validate(), the UDP header is > located using iph->ihl, which comes from the packet and is never > checked: > > /* Don't assume skb_transport_header() was set */ > udph = (struct udphdr *)((u8 *)iph + 4 * iph->ihl); > if (udph->dest != htons(9)) > goto out; > > mlxh = (struct mlx5ehdr *)((char *)udph + sizeof(*udph)); > if (mlxh->magic != cpu_to_be64(MLX5E_TEST_MAGIC)) > > The only length check is this one: > > if (MLX5E_TEST_PKT_SIZE - ETH_HLEN > skb_headlen(skb)) > goto out; > > That guarantees 44 bytes: 20 for IP, 8 for UDP, and 16 for struct > mlx5ehdr, which includes the padding before magic. > > The hook is registered with dev_add_pack() for every ETH_P_IP frame on > priv->netdev. While the loopback test is running, could an external UDP > frame sent to the port MAC with ihl up to 15 make this code read > udph->dest and mlxh->magic up to 40 bytes past skb_headlen()? > > Those bytes stay inside the skb head allocation, in the tailroom or > skb_shared_info, and they are only compared against constants. The > result could be a spurious selftest outcome or a KMSAN uninit-value > report. Would it make sense to check 4 * iph->ihl against skb_headlen() > before using it? Yes, pre-existing. I can send a separate patch for this.