Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mst@redhat.com
Cc: linux-kernel@vger.kernel.org, willemdebruijn.kernel@gmail.com,
	jasowangio@gmail.com, eperezma@redhat.com,
	xuanzhuo@linux.alibaba.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	virtualization@lists.linux.dev, maxk@qualcomm.com,
	rusty@rustcorp.com.au, horms@kernel.org
Subject: Re: [PATCH net-next 4/4] net: account for ingress-resolved virtio net hdr state
Date: Wed, 14 Oct 2026 10:59:32 +0000	[thread overview]
Message-ID: <179197557205.434549.14468645046355875778@kernel.org> (raw)
In-Reply-To: <d82518764906d3b552fd3ade65b96ac741197d4e.1791887415.git.mst@redhat.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

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] This patch silently fixes a packet-drop regression introduced
  by the previous commit in the series, "net: resolve uncommon partial…
- [Medium] tun_get_ethtool_stats() assigns `data[0] =
  atomic_long_read(&tun->rx_csum_sw);` straight into the u64 ethtool…
- [Low] The trailer `Fixes: f43798c27684 ("tun: Allow GSO using
  virtio_net_hdr")` names a July 2008 commit by Rusty Russell (verified…

--

net: account for ingress-resolved virtio net hdr state

After this commit, virtio_net_hdr_to_skb() returns 1 when it completes an
uncommon checksum in software at ingress. The converter call sites in tap,
tun, virtio_net and af_packet now test for a negative errno. tun counts
these events per device as rx_csum_sw and exposes the counter through
ethtool -S.

> Fixes: f43798c27684 ("tun: Allow GSO using virtio_net_hdr")

[Severity: Low]
Is this the right Fixes: target? f43798c27684 is the 2008 commit that
added GSO via virtio_net_hdr to tun.

Software checksum completion in the converter first appears in the
previous patch in this series, "net: resolve uncommon partial checksums
at ingress". So does the positive return value this patch accounts for.
At the baseline there is no skb_checksum_help() call in
include/linux/virtio_net.h.

Stable tooling that follows this tag could offer the patch to every
stable branch since 2.6.27. On those branches the "return err ?: 1"
hunk has nothing to apply to, and rx_csum_sw would always read 0.

Should the tag be dropped? If it is meant to cover the call site fix
below, should it point at the previous commit in this series instead?

> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 8b82a7fe6ec7f..b8961229737fd 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c

[ ... ]

> @@ -1935,11 +1936,19 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
>  		break;
>  	}
>  
> -	if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr)) {
> +	err = tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr);
> +	if (err < 0) {
>  		atomic_long_inc(&tun->rx_frame_errors);
>  		err = -EINVAL;
>  		goto free_skb;
>  	}

[Severity: Medium]
Does this change also fix a regression from the previous patch in the
series, "net: resolve uncommon partial checksums at ingress"?

That commit already made virtio_net_hdr_tnl_to_skb() return 1 on the
UDP tunnel path after a successful software checksum:

include/linux/virtio_net.h:virtio_net_hdr_tnl_to_skb() {
    ...
	ret = skb_checksum_help(skb);
	return ret ?: 1;
}

At that commit, the tunnel converter callers still treated any nonzero
return as a failure:

tun_get_user():
	if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr)) {
		atomic_long_inc(&tun->rx_frame_errors);
		err = -EINVAL;
		goto free_skb;
	}

tun_xdp_one() had the same pattern. virtnet_receive_done() went to
frame_err and printed a "bad gso" warning.

Take a UDP tunnel header with these properties:

  - NEEDS_CSUM is set.
  - The payload is no larger than gso_size, so skb_is_gso() is false.
  - The inner csum offsets fail virtio_net_csum_partial_ok_at_offset().

With only the previous commit applied, such a packet would have its
checksum completed and then be dropped as a frame error. tun write()
would return -EINVAL for it.

This commit message describes the "< 0" changes only as accounting
plumbing. To keep the series bisectable, could the call site changes be
folded into "net: resolve uncommon partial checksums at ingress"?
Alternatively, could this commit message say that it fixes that commit?

> +	if (err > 0)
> +		atomic_long_inc(&tun->rx_csum_sw);

[ ... ]

> @@ -3739,7 +3751,35 @@ static void tun_get_channels(struct net_device *dev,

[ ... ]

> +static void tun_get_ethtool_stats(struct net_device *dev,
> +				  struct ethtool_stats *stats, u64 *data)
> +{
> +	struct tun_struct *tun = netdev_priv(dev);
> +
> +	data[0] = atomic_long_read(&tun->rx_csum_sw);

[Severity: Medium]
On 32-bit builds, atomic_long_t is an atomic_t and atomic_long_read()
returns a signed long. Once rx_csum_sw passes 2^31, can the implicit
conversion to u64 sign-extend the value? ethtool -S would then report
something like 0xffffffff80000000.

tun_net_get_stats64() in the same file avoids this for the sibling
counter:

	stats->rx_frame_errors +=
		(unsigned long)atomic_long_read(&tun->rx_frame_errors);

Should this read use the same (unsigned long) cast?

> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1791887415.git.mst%40redhat.com

  parent reply	other threads:[~2026-10-14 10:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 10:58 [PATCH net-next 0/4] more virtio-net csum hardening Michael S. Tsirkin
2026-10-13 10:58 ` [PATCH net-next 1/4] net: add ip4_parse() Michael S. Tsirkin
2026-10-14 10:59   ` netdev-bot+sashiko
2026-10-13 10:58 ` [PATCH net-next 2/4] net: use ip4_parse() in receive validation Michael S. Tsirkin
2026-10-14 10:59   ` netdev-bot+sashiko
2026-10-13 10:58 ` [PATCH net-next 3/4] net: resolve uncommon partial checksums at ingress Michael S. Tsirkin
2026-10-13 11:06   ` Michael S. Tsirkin
2026-10-13 15:03     ` Willem de Bruijn
2026-10-13 18:35       ` Michael S. Tsirkin
2026-10-13 20:32         ` Willem de Bruijn
2026-10-13 20:38           ` Michael S. Tsirkin
2026-10-13 20:45             ` Willem de Bruijn
2026-10-13 20:51               ` Michael S. Tsirkin
2026-10-13 20:15       ` Michael S. Tsirkin
2026-10-14 10:59   ` netdev-bot+sashiko
2026-10-13 10:58 ` [PATCH net-next 4/4] net: account for ingress-resolved virtio net hdr state Michael S. Tsirkin
2026-10-13 17:45   ` Björn Töpel
2026-10-13 18:12     ` Michael S. Tsirkin
2026-10-14 10:59   ` netdev-bot+sashiko [this message]
2026-10-13 11:05 ` [PATCH net-next 0/4] more virtio-net csum hardening Michael S. Tsirkin
2026-10-13 18:51   ` Chris Arges
2026-10-13 14:41 ` Willem de Bruijn
2026-10-13 18:41   ` Michael S. Tsirkin
2026-10-13 20:29     ` Willem de Bruijn
2026-10-13 20:36       ` Michael S. Tsirkin
2026-10-13 20:54         ` Willem de Bruijn
2026-10-13 20:56           ` Michael S. Tsirkin

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=179197557205.434549.14468645046355875778@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=horms@kernel.org \
    --cc=jasowangio@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxk@qualcomm.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux.dev \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=xuanzhuo@linux.alibaba.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