mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-kernel@vger.kernel.org,
	"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
	"Jason Wang" <jasowangio@gmail.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	netdev@vger.kernel.org, virtualization@lists.linux.dev,
	"Rusty Russell" <rusty@rustcorp.com.au>,
	"Max Krasnyansky" <maxk@qualcomm.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	linux-um@lists.infradead.org
Subject: Re: [PATCH net-next v2 2/7] um: vector: honor virtio net hdr conversion failures
Date: Fri, 16 Oct 2026 05:47:16 -0400	[thread overview]
Message-ID: <20261016054558-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <18ba10ec7aa6659ee4711f8dd3f3138e314e4af6.camel@sipsolutions.net>

On Fri, Oct 16, 2026 at 11:44:16AM +0200, Johannes Berg wrote:
> On Fri, 2026-10-16 at 05:43 -0400, Michael S. Tsirkin wrote:
> > 
> > > > > > -	virtio_net_hdr_to_skb(skb, vheader, virtio_legacy_is_little_endian());
> > > > > > +	if (virtio_net_hdr_to_skb(skb, vheader,
> > > > > > +			virtio_legacy_is_little_endian()) < 0)
> > > > > > +		return -1;
> > > > > >  	return 0;
> > > > > > 
> > > > > 
> > > > > Seems it'd be simpler to just
> > > > > 
> > > > > 	return virtio_net_hdr_to_skb(...);
> > > > > 
> > > > > As far as I can tell, the function only returns -EINVAL or 0 (never a
> > > > > positive value), and the caller only cares about negative (error) or
> > > > > positive (no checksum needed), so that'd be equivalent?
> > > > > 
> > > > > johannes
> > > > 
> > > > if raw_verify_header can safely return any errno - i did not want to
> > > > audit it.
> > > 
> > > You already used an LLM and still didn't want to? ;-)
> > > 
> > > I checked briefly (by hand) and it seems fine, it's assigned to the
> > > function pointer, which only has two callers on the _kern.c side.
> > > 
> > > johannes
> > 
> > 
> >                                header_check = vp->verify_header(
> >                                         mmsg_vector->msg_hdr.msg_iov->iov_base,
> >                                         skb,
> >                                         vp
> >                                 );
> >                                 if (header_check < 0) {
> >                                 /* Overlay header failed to verify - discard.
> >                                  * We can actually keep this skb and reuse it,
> >                                  * but that will make the prep logic too
> >                                  * complex.
> >                                  */
> >                                         dev_kfree_skb_irq(skb);
> >                                         vp->estats.rx_encaps_errors++;
> >                                         (*skbuff_vector) = NULL;
> >                                         mmsg_vector++;
> >                                         skbuff_vector++;
> >                                         continue;
> >                                 }
> >                                 if (header_check > 0) {
> >                                         vp->estats.rx_csum_offload_good++;
> >                                         skb->ip_summed = CHECKSUM_UNNECESSARY;
> >                                 }
> > 
> > 
> > 
> > so any negative is fine, but if we return 1 then it will force to CHECKSUM_UNNECESSARY
> > which I am not sure is what was intended?
> > 
> Right, but virtio_net_hdr_to_skb() cannot return 1, only 0 on success
> and -ERROR on failure?
> 
> johannes

After this patchset, it can, to signal slow path software checksum.
I'm changing callers first so that changing the function itself
does not break bisect. I should mention this in the commit log.

-- 
MST


  reply	other threads:[~2026-10-16  9:47 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 12:41 [PATCH net-next v2 0/7] more virtio-net csum hardening Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 1/7] net: account for ingress-resolved virtio net hdr state Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 2/7] um: vector: honor virtio net hdr conversion failures Michael S. Tsirkin
2026-10-15 12:47   ` Johannes Berg
2026-10-15 12:52     ` Michael S. Tsirkin
2026-10-15 12:55       ` Johannes Berg
2026-10-16  9:37         ` Michael S. Tsirkin
2026-10-16  9:43         ` Michael S. Tsirkin
2026-10-16  9:44           ` Johannes Berg
2026-10-16  9:47             ` Michael S. Tsirkin [this message]
2026-10-16  9:49               ` Johannes Berg
2026-10-16  9:53                 ` Michael S. Tsirkin
2026-10-15 17:19   ` Willem de Bruijn
2026-10-16  9:40     ` Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 3/7] um: vector: trim skbs before verifying the header Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 4/7] net: resolve uncommon partial checksums at ingress Michael S. Tsirkin
2026-10-15 17:43   ` Willem de Bruijn
2026-10-15 19:18     ` Chris Arges
2026-10-16  9:34       ` Michael S. Tsirkin
2026-10-16  9:36     ` Michael S. Tsirkin
2026-10-15 18:04   ` Willem de Bruijn
2026-10-15 18:07   ` Willem de Bruijn
2026-10-16 10:02   ` Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 5/7] net: add a sysctl to opt out of virtio net hdr checksum validation Michael S. Tsirkin
2026-10-15 17:50   ` Willem de Bruijn
2026-10-16  9:33     ` Michael S. Tsirkin
2026-10-16 15:30       ` Willem de Bruijn
2026-10-16 17:51         ` Michael S. Tsirkin
2026-10-16 18:19           ` Willem de Bruijn
2026-10-16 18:40             ` Michael S. Tsirkin
2026-10-16 17:55         ` Michael S. Tsirkin
2026-10-16 18:17           ` Willem de Bruijn
2026-10-15 12:41 ` [PATCH net-next v2 6/7] net: add ip4_parse() Michael S. Tsirkin
2026-10-15 18:51   ` Phil Sutter
2026-10-16 11:56   ` Björn Töpel
2026-10-15 12:41 ` [PATCH net-next v2 7/7] virtio_net: cleanup protocol calculation Michael S. Tsirkin
2026-10-16 11:52   ` Björn Töpel
2026-10-15 19:21 ` [PATCH net-next v2 0/7] more virtio-net csum hardening Chris Arges

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=20261016054558-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=maxk@qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richard@nod.at \
    --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

all inboxes | Powered by JetHome®