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 <litt…@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: syzb…@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/2026…%40gmail.com