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=1796301542; b=mMrQ/v28+jQurnH+tsH+TCiIkHOBZWPStymRv2mvNJdrRFtwKW6oYKHaBAqUX3YuHG+A cHNTQW1EYZuwy2U+EgFuGEo8XWJzm/MxaddDmjzlTagokwNVbyWnTLnt9voMnLOd352F0 60Ea4afZ7AR9PHV0PkEu1y15rLoXrAHET8S36tIto25L9VrNyxlm3zYRECBQ7nAL61LzQ kPCOrYyr7uOlu4BUhrtUJqW+Om5f1VDVM8b5pv9N1qRDXT4FtOaTOL5Bq7s21RDPVl7m3 Az43WvqoqVCY3Ah5HL7wEVHbZclcoYaJ3HYn3q/DcHJTTO1h9xfqj4SSRTSsnTKVfjQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796301542; 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=fDxBz/5enP1IYxcTmSGaDq5DAcrHP+LoNvZMIBDW+QY=; b=obCI7+WvM8r+zwSEpUICM9yYt13uF5oE3tt3+ycQ/LGWlf4YpCs92/Zpipat8giBk2Vz 00Jo/jwwexBAqDrUOEevNQ2QsVBNhnNhlVXPYg5HL77+k1TjN3kqp3W8EU+7L7jwoA4HM MLMgF4L9Mjn5w3ILSlx+LXJmZTXUebCbPovoa1OMV+AbqP9PWtPJKZEu6bl2U6gxR7o+c fGPigjZFlj+RlHLmnotXTGRNvuaa/oWEnX3y7ySydNzked19AEpwk7kloUuX5i7yz4B6A jmoHIpZB5iPULqS+4Jvl+LG2CAF9uwAz2KPO4hceuMeXkptc3s0RomWYDlMOy8axVDg== 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=ksJn0dPf; 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 CBA85606A6A8; Thu, 3 Dec 2026 12:39:02 +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=ksJn0dPf Received: by smtp.kernel.org (Postfix) with ESMTPSA id 952B11F000C1; Thu, 3 Dec 2026 12:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796301542; bh=fDxBz/5enP1IYxcTmSGaDq5DAcrHP+LoNvZMIBDW+QY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ksJn0dPfsDk93VOGix9zYpAXeUFov+3ex82P0C76B33dSH9I0M+YNVR3080eDtkeK hyBN1ZAU3TsmAneBw6piLOg7Xhg6nrXLiSGu6QBO4olJdmgLeSgowm5MQAKSwcrC+q bENQ2/Mx18AUSzQPPyqsNGrxdn0oXVMDr+o5qZDhtbPjv3D2AfPcgfYOhLxNcwH+pO 1vGeMatNOuyN9N8uQAkyU683IyiqljCiyWEfccSuEZ3qyJJDE4UMAQi5wiT0O2Oj45 umenLGxmRZvnFgPRYQG4weFhid0MOd9Bs133A+nX6B7YArGjdQncEzOOj/gJg3Q/vA ew2ixO7AYb1oA== Subject: Re: [PATCH net-next v8 3/5] ip6_gre: classify the inner packet once on transmit From: netdev-bot+sashiko@kernel.org To: littlesmilingcloud@gmail.com Cc: netdev@vger.kernel.org, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net, horms@kernel.org, dsahern@kernel.org, willemb@google.com, idosch@nvidia.com, fw@strlen.de, u9012063@gmail.com, mvohra@vmware.com, matthias.may@westermo.com, mazin@getstate.dev, shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 03 Dec 2026 12:39:01 +0000 Message-ID: <179630154116.3146.4207161011188835860@kernel.org> In-Reply-To: <20261202123613.1708463-4-littlesmilingcloud@gmail.com> References: <20261202123613.1708463-4-littlesmilingcloud@gmail.com> X-sashiko-severity: Medium 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 1 potential issue(s) to consider. Critical: 0 · High: 0 · 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] In this commit, ip6erspan_tunnel_xmit() (net/ipv6/ip6_gre.c) passes the classified payload_protocol only to ip6_tnl_xmit() (line… -- ip6_gre: classify the inner packet once on transmit This commit adds ip6gre_xmit_classify(). It works out the inner protocol once, on entry to ip6gre_tunnel_xmit() and ip6erspan_tunnel_xmit(). On Ethernet devices it looks through VLAN tags and pulls the inner IP header. The result is passed down to ip6_tnl_xmit() as a new payload_protocol argument. That replaces the skb_protocol(skb, true) calls, which parsed the frame again after the GRE and ERSPAN headers were pushed. Closes: https://syzkaller.appspot.com/bug?extid=6023ea32e206eef7920a > diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c > index 51f4311bebfa4..c413e47c6ceb0 100644 > --- a/net/ipv6/ip6_gre.c > +++ b/net/ipv6/ip6_gre.c [ ... ] > @@ -950,7 +1005,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, > __u32 mtu; > int nhoff; > > - if (!pskb_inet_may_pull(skb)) > + if (ip6gre_xmit_classify(skb, dev, &payload_protocol)) > goto tx_err; > > if (!ip6_tnl_xmit_ctl(t, &t->parms.laddr, &t->parms.raddr)) [ ... ] > @@ -1073,7 +1128,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, > htonl(atomic_fetch_inc(&t->o_seqno))); > > err = ip6_tnl_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu, > - NEXTHDR_GRE); > + NEXTHDR_GRE, payload_protocol); > if (err != 0) { > /* XXX: send ICMP error even if DF is not set. */ > if (err == -EMSGSIZE) { [Severity: Medium] payload_protocol is passed to ip6_tnl_xmit() here. Does the rest of ip6erspan_tunnel_xmit() still go by skb->protocol? In this commit the truncate checks, the native mode dispatch and the choice of ICMP family are unchanged: net/ipv6/ip6_gre.c:ip6erspan_tunnel_xmit() { ... nhoff = skb_network_offset(skb); if (skb->protocol == htons(ETH_P_IP) && (ntohs(ip_hdr(skb)->tot_len) > skb->len - nhoff)) truncate = true; if (skb->protocol == htons(ETH_P_IPV6)) { ... } else { switch (skb->protocol) { case htons(ETH_P_IP): ... if (err == -EMSGSIZE) { if (skb->protocol == htons(ETH_P_IP)) icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); else icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); ... } ip6_tnl_xmit() now takes payload_protocol as an argument, but its MTU floor still checks skb->protocol: net/ipv6/ip6_tunnel.c:ip6_tnl_xmit() { ... mtu = max(mtu, skb->protocol == htons(ETH_P_IPV6) ? IPV6_MIN_MTU : IPV4_MIN_MTU); ... } Take a VLAN-tagged IPv4 or IPv6 frame on a native ip6erspan device. ip6gre_xmit_classify() sets payload_protocol to ETH_P_IP or ETH_P_IPV6, so the hop limit is inherited from the inner header. The switch on skb->protocol still takes the default branch, though. That skips prepare_ip6gre_xmit_ipv4() and prepare_ip6gre_xmit_ipv6(), so the traffic class, flow label and encap_limit do not come from the inner header. The truncate bit is not set from the inner length either. On -EMSGSIZE, a tagged IPv4 frame would be passed to icmpv6_ndo_send() with an IPv4 header at the network header. icmp6_send() bounds-checks that read, so the result is a bogus PKT_TOOBIG, not memory corruption. These sites behaved the same way before this patch. Even so, the behaviour doesn't seem to match the new comment above ip6gre_xmit_classify(): Nothing below parses the frame again: the answer is passed down, also to ip6_tnl_xmit(). The next patch in the series, "ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan", appears to switch all four sites to payload_protocol and to send icmpv6_ndo_send() only for ETH_P_IPV6. Could that change be folded into this one? If not, could the comment and the commit message be adjusted so this commit is accurate on its own? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202123613.1708463-1-littlesmilingcloud%40gmail.com