Netdev List
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: "Björn Töpel" <bjorn@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Mina Almasry <almasrymina@google.com>,
	Willem de Bruijn <willemb@google.com>,
	 Kaiyuan Zhang <kaiyuanz@google.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: Avoid checksumming unreadable skb tail on trim
Date: Mon, 25 May 2026 16:28:44 +0100	[thread overview]
Message-ID: <ahRqi5ECb3LMHiWb@gmail.com> (raw)
In-Reply-To: <CAJ+HfNh6pYEQKPhKxDp=8VgtweqwTZysHAfOEj3g5pJZJYYq0Q@mail.gmail.com>

On Mon, May 25, 2026 at 01:18:51PM +0000, Björn Töpel wrote:
> On Fri, 22 May 2026 at 17:39, Breno Leitao <leitao@debian.org> wrote:
> >
> > On Fri, May 22, 2026 at 02:06:40PM +0200, Björn Töpel wrote:
> > > pskb_trim_rcsum_slow() keeps CHECKSUM_COMPLETE valid by subtracting
> > > the checksum of the bytes removed from the skb tail. That assumes the
> > > removed bytes can be read.
> > >
> > > io_uring zcrx skbs may contain unreadable net_iov frags. With fbnic
> > > header/data split, small TCP/IPv4 packets can carry Ethernet padding
> > > in such a frag. ip_rcv_core() trims the skb to iph->tot_len before TCP
> > > sees it, and the CHECKSUM_COMPLETE adjustment then calls
> > > skb_checksum() on the padding.
> > >
> > > This is exposed by IPv4 because small TCP/IPv4 frames can be shorter
> > > than the Ethernet minimum payload. TCP/IPv6 frames are large enough in
> > > the normal zcrx path, so they do not hit the same padding trim.
> > >
> > > Keep the existing checksum adjustment for readable skbs. If the
> > > remaining packet is fully linear, drop CHECKSUM_COMPLETE and let the
> > > stack validate the packet after trimming. If unreadable payload would
> > > remain, fail the trim; the checksum cannot be adjusted without reading
> > > the trimmed tail.
> > >
> > > Also clear skb->unreadable when trimming removes all frags.
> > >
> > > Fixes: 65249feb6b3d ("net: add support for skbs with unreadable frags")
> > > Signed-off-by: Björn Töpel <bjorn@kernel.org>
> >
> > Reviewed-by: Breno Leitao <leitao@debian.org>
> 
> Thanks, Breno!
> 
> > > +static int pskb_trim_rcsum_complete(struct sk_buff *skb, unsigned int len)
> > > +{
> > > +     int delta = skb->len - len;
> >
> > I suppose this is not unsigned/size_t because csum_block_sub() requires
> > an 'int', is this right?
> 
> Yup, both skb_checksum() length and csum_block_sub() offset are int,
> and it also keeps the existing parent function's local type unchanged
> after the move.
> 
> > >  /* Note : use pskb_trim_rcsum() instead of calling this directly
> > >   */
> >
> > I think you can make this a one-line comment, or just a proper kdoc.
> 
> Yes, but note that this was not an addition from me. I can fix it up
> if there are more changes required!

oh, nevermind. I misread it.

Thanks


  reply	other threads:[~2026-05-25 15:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 12:06 [PATCH net] net: Avoid checksumming unreadable skb tail on trim Björn Töpel
2026-05-22 15:39 ` Breno Leitao
2026-05-25 11:18   ` Björn Töpel
2026-05-25 15:28     ` Breno Leitao [this message]
2026-05-26 13:35 ` patchwork-bot+netdevbpf

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=ahRqi5ECb3LMHiWb@gmail.com \
    --to=leitao@debian.org \
    --cc=almasrymina@google.com \
    --cc=bjorn@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kaiyuanz@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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