Netdev List
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH net-next v7 2/5] erspan: take the COS from the mirrored frame, not from the tunnel family
Date: Thu, 03 Dec 2026 03:59:39 +0000	[thread overview]
Message-ID: <179627037924.3146.7104138756725327763@kernel.org> (raw)
In-Reply-To: <20261201005941.1536429-3-littlesmilingcloud@gmail.com>

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 commit "erspan: take the COS from the mirrored frame, not
  from the tunnel family" fixes two old bugs in erspan_build_header()…

--

erspan: take the COS from the mirrored frame, not from the tunnel family

The patch adds a helper, erspan_frame_tos(). erspan_build_header() and
erspan_build_header_v2() now use it to read the TOS for the ERSPAN COS
field from the mirrored frame, not from the tunnel family. The helper
reads the two bytes with skb_header_pointer(), and the patch drops the
is_ipv4 argument and the stale forward declaration in ip_gre.c.

> erspan: take the COS from the mirrored frame, not from the tunnel family
>
> erspan_build_header() and erspan_build_header_v2() take the TOS for
> the COS field from ip_hdr(skb)->tos when the tunnel is IPv4 and from
> the IPv6 traffic class when the tunnel is IPv6. But is_ipv4 describes
> the tunnel, not the mirrored frame, so

[ ... ]

>  - a frame that is neither gets its COS from whatever lies at the
>    network header offset, which for a short frame is past its end.

[ ... ]

>  - a 14 byte non-IP frame gives a KMSAN report when the packet is
>    received on the other side; with the patch it does not.
>
> Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>

[Severity: Low]
Should this patch have Fixes: tags?

It fixes two old problems in erspan_build_header() and
erspan_build_header_v2() in include/net/erspan.h:

- For short non-IP frames, the ip_hdr(skb)->tos / ipv6_hdr(skb) read at
  the network header is unbounded, and KMSAN reports it.
- The COS is wrong when the mirrored frame's family differs from the
  tunnel's.

The previous patch in the series, "erspan: bound the VLAN tag read in
erspan_build_header{,_v2}()", has these tags:

    Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
    Fixes: f551c91de262 ("net: erspan: introduce erspan v2 for ip_gre")
    Reported-by: syzbot+9e27778c0edc62cb97d8@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=9e27778c0edc62cb97d8

Its message also says it depends on this patch:

    With this patch and the next one, which bounds the remaining
    read of this kind, the same frames give no report on erspan.

Without Fixes: tags here, stable selection could take only the first
patch. Stable kernels would then keep the uninitialized TOS read and the
wrong COS.

The old read can be reached on existing kernels. erspan_xmit() checks the
length only through pskb_inet_may_pull_reason(), and that pulls nothing
for a non-IP skb->protocol:

include/net/ip_tunnels.h:pskb_inet_may_pull_reason() {
    ...
	default:
		nhlen = 0;
	}

	return pskb_network_may_pull_reason(skb, nhlen);
}

Blame on the baseline shows where the two reads came from:

- the one in erspan_build_header() with a3222dc95ca7
- the one in erspan_build_header_v2() with f551c91de262

Would it work to use the same two Fixes: tags as the previous patch,
plus the commit that added the ip6erspan callers that pass is_ipv4 as
false? A note saying that this patch completes the syzbot fix could
also help.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201005941.1536429-1-littlesmilingcloud%40gmail.com

  reply	other threads:[~2026-12-03  3:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  0:59 [PATCH net-next v7 0/5] ip6_gre, erspan: fix inner header handling for VLAN-tagged and short frames Anton Danilov
2026-12-01  0:59 ` [PATCH net-next v7 1/5] erspan: bound the VLAN tag read in erspan_build_header{,_v2}() Anton Danilov
2026-12-01  0:59 ` [PATCH net-next v7 2/5] erspan: take the COS from the mirrored frame, not from the tunnel family Anton Danilov
2026-12-03  3:59   ` netdev-bot+sashiko [this message]
2026-12-01  0:59 ` [PATCH net-next v7 3/5] ip6_gre: classify the inner packet once on transmit Anton Danilov
2026-12-01  0:59 ` [PATCH net-next v7 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan Anton Danilov
2026-12-03  3:59   ` netdev-bot+sashiko
2026-12-01  0:59 ` [PATCH net-next v7 5/5] selftests: net: add a test for ip6gretap and ip6erspan with VLAN tags Anton Danilov
2026-12-03  3:59   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179627037924.3146.7104138756725327763@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=littlesmilingcloud@gmail.com \
    --cc=matthias.may@westermo.com \
    --cc=mazin@getstate.dev \
    --cc=mvohra@vmware.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=u9012063@gmail.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox