From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796060198; b=JFz6dEY7PexOQvQs9eFXjSh3eU1aXYdkYYYU1lDcHK3nCI4Fs9hl2YZDy6SWSBM7q14+ SCH+BozwRUilyD5D900r2CohVF+ASUwhsCgk2uoXt07dmkBXzYgMv8Tf4J1oEHS6cPWt9 PpRZH0iGDhzqE/+JtLe1VWxCEPNjJ4LrpUjWOzkRzrvT0kIbmRQ9qZ5L7kZlKlUZWR/80 fjyn7TW/qhR1Ouc7in4lQ0Q+GeVi5KIdOYraXrsaW/s+kwtjw6zyAQQL9zO4DgSsMfeRj Jf95+DP9d3L+1kIpGcvyLoG3ADrcSpsaHBoKgJ90EIFzmxaatXF59VSkmYfZhtcH7PA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796060198; 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=MEFuHJ3mke1qEblqtW3JNj+0TcfaptiKIOztC6qslgA=; b=gkfcwgqIPbRtf58DOKkbHpZ8p6oOs1H0Qm2uXgWaxSgjQv2UyhgtOylzhTZ6mDz7VZtL Pz1Rv/4QfkBuYlrPQyHAD4FLVCgtR0g5HWBHZpOcUz0O52h/4vQAyy7cMMdArio3OGP9K PaZvrFF5LqLziYF/8qblPDwxLwQZ4XYUrY9NnSgJKJih/e/IT/xBpHApwlkafuqUy+oBY tFCfGakkqsLhXz7qts5cbU9E2llcRSmd4WFGk4HAOhDZK2ouuz1zLXdAZHFNz42rRGWjn ZOqW6fiiExt3nsFLEF/lZ3POL4/0ydLUtKMeLY3Y1/apmemzFU3Ez2JUkqaPTrwcvew== 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=NdwaVtV6; arc=none smtp.remote-ip=100.103.45.18 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 9B55B606A32E for ; Mon, 30 Nov 2026 17:36:38 +0000 (UTC) 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=NdwaVtV6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E0601F00898; Mon, 30 Nov 2026 17:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796060198; bh=MEFuHJ3mke1qEblqtW3JNj+0TcfaptiKIOztC6qslgA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NdwaVtV6JkQT07vDA22kaWGuD7NxHfM1rm6pOcodxyGIR2fiIx5ndVe6M+Qoj/O8n UTkcT+K7jH15B4/HinmD/aooHI7RYz1T/ewV62MFl/g0UxQyJe+F2oVGxzj67If9Oy KGspLST9b7fzCI/+icpY7YxfyKseiaM1ywsStNDtVZco+G2keGX1fAp9sVft//VQce G+muXf7fq88NIBMfA8/QRryI3z+57peb1DK0pkdbAloAMSCeQ/7ylonVVva0vPQVMQ DwlxepggWRfNIyCwCOnD0fdWiQzloD5UPWEE61ZUxqXUTi8n9sSVHOn7Gd4/piS2nC md7/x1aqlnVwA== Subject: Re: [PATCH net-next v2 4/5] packet: use Ethernet header length in vlan_get_tci() From: netdev-bot+sashiko@kernel.org To: willemb@google.com Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, elder@kernel.org Date: Mon, 30 Nov 2026 17:36:37 +0000 Message-ID: <179606019715.3146.2252735958159883067@kernel.org> In-Reply-To: <20261129163327.893403-5-willemb@google.com> References: <20261129163327.893403-5-willemb@google.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The patch fixes VLAN metadata that userspace sees, but the commit has no Fixes: tag. - [Low] The commit message says the is_vlan_dev() fallback in vlan_get_tci() 'has been obsolete since commit 447cbe95ebb9'. -- packet: use Ethernet header length in vlan_get_tci() This commit makes vlan_get_tci() read the outer VLAN header at ETH_HLEN, and only for ARPHRD_ETHER and ARPHRD_LOOPBACK devices. The helper now returns whether a TCI was extracted. tpacket_rcv(), prb_fill_vlan_info() and packet_recvmsg() only set the VLAN valid flags when it was, and packet_recvmsg() no longer looks up the device under RCU. > vlan_get_tci() uses dev->min_header_len to locate the outer 802.1Q/AD > header on SOCK_DGRAM captures, with an is_vlan_dev() fallback that has > been obsolete since commit 447cbe95ebb9 ("vlan: fix skb_under_panic and > races when toggling HW VLAN offload") stopped adding VLAN_HLEN to > vlandev->hard_header_len. [Severity: Low] Is the is_vlan_dev() fallback really obsolete since 447cbe95ebb9? A VLAN device still inherits hard_header_len from its lower device: net/8021q/vlan_dev.c:vlan_dev_init() { ... dev->hard_header_len = real_dev->hard_header_len; ... } vlan_transfer_features() does the same thing: vlandev->hard_header_len = dev->hard_header_len; vlan_setup() calls ether_setup(), so min_header_len stays at ETH_HLEN. Some lower Ethernet devices have a hard_header_len larger than ETH_HLEN. smsc95xx is one: drivers/net/usb/smsc95xx.c:smsc95xx_bind() { ... dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; ... } rndis_host is another. For a VLAN device on top of one of these, min_header_len != hard_header_len, so the old vlan_get_tci() still took the is_vlan_dev() branch to get header_len = ETH_HLEN. The new code that reads at ETH_HLEN gives the right result either way, so only the explanation is affected. Could the wording be changed so backporters don't read it as a dependency on 447cbe95ebb9? [ ... ] > This changes the reported VLAN metadata in three cases: > > - Ethernet devices with hard_header_len != ETH_HLEN (e.g., smsc95xx, > rndis_host) previously failed the min_header_len == hard_header_len > test and reported TCI 0. They now report the actual TCI. > - Non-Ethernet devices and frames without an extractable VLAN header > previously still set TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID: > headerless devices (e.g., tun, rmnet) matched 0 == 0 and read payload > bytes at offset 0 as TCI, while other non-Ethernet devices and > truncated frames reported TCI 0. They now omit VLAN metadata and flags. > - packet_recvmsg() previously omitted the VLAN fields if the device > had been unregistered since the packet was queued. It now fills > them from the queued skb. > > Signed-off-by: Willem de Bruijn [Severity: Low] The first two cases fix wrong VLAN metadata that userspace sees, so should this have a Fixes: tag? Two pieces of code come from 79eecf631c14. One is the min_header_len / hard_header_len / is_vlan_dev() logic in vlan_get_tci(). The other is the code in tpacket_rcv(), prb_fill_vlan_info() and packet_recvmsg() that sets TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID whatever vlan_get_tci() returns. The old return value of 0 could not be told apart from a valid TCI of 0. Fixes: 79eecf631c14 ("af_packet: Handle outgoing VLAN packets without hardware offloading") Since that commit, a SOCK_DGRAM capture of software-tagged VLAN traffic on smsc95xx reports TCI 0 with the valid flags set. Headerless devices report payload bytes as the TCI, also with the valid flags set. Without the tag, stable trees that carry 79eecf631c14 have nothing pointing them at this fix. The subject "use Ethernet header length in vlan_get_tci()" and the "removing the last min_header_len reader" framing also read like a refactor rather than a fix for wrong output. -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129163327.893403-1-willemb%40google.com