netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Network Development <netdev@vger.kernel.org>
Cc: David Miller <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jason Wang <jasowang@redhat.com>,
	Maxim Mikityanskiy <maximmi@mellanox.com>,
	Willem de Bruijn <willemb@google.com>,
	syzbot <syzkaller@googlegroups.com>
Subject: Re: [PATCH net] net: validate untrusted gso packets without csum offload
Date: Mon, 18 Feb 2019 23:40:42 -0500	[thread overview]
Message-ID: <CAF=yD-+vcfsWMWuHxDuR_V5J7FFLjzCc=1LQkO_zt7HMzWXQAQ@mail.gmail.com> (raw)
In-Reply-To: <CAF=yD-JMwss15tDEpXq0_399H_BTHmmCX30sgUj0Zu94A4ABYw@mail.gmail.com>

On Mon, Feb 18, 2019 at 2:12 PM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> On Fri, Feb 15, 2019 at 12:15 PM Willem de Bruijn
> <willemdebruijn.kernel@gmail.com> wrote:
> >
> > From: Willem de Bruijn <willemb@google.com>
> >
> > Syzkaller again found a path to a kernel crash through bad gso input.
> > By building an excessively large packet to cause an skb field to wrap.
> >
> > If VIRTIO_NET_HDR_F_NEEDS_CSUM was set this would have been dropped in
> > skb_partial_csum_set.
> >
> > GSO packets that do not set checksum offload are suspicious and rare.
> > Most callers of virtio_net_hdr_to_skb already pass them to
> > skb_probe_transport_header.
> >
> > Move that test forward, change it to detect parse failure and drop
> > packets on failure as those cleary are not one of the legitimate
> > VIRTIO_NET_HDR_GSO types.
> >
> > Fixes: bfd5f4a3d605 ("packet: Add GSO/csum offload support.")
> > Fixes: f43798c27684 ("tun: Allow GSO using virtio_net_hdr")
> > Reported-by: syzbot <syzkaller@googlegroups.com>
> > Signed-off-by: Willem de Bruijn <willemb@google.com>
>
> This causes false positive drops on virtio-net and tun for these
> packets with gso without csum_off. And on pf_packet with proto 0.
>
> This happens because skb->protocol is set in these callers after
> the call to virtio_net_hdr_to_skb. And the flow dissector relies on
> this to start dissection, not the link layer header (if present).
> Moving this logic forward is too much churn for net, especially since
> eth_type_header pulls the header, requiring additional changes to
> adjust csum_start.
>
> virtio_net_hdr_set_proto() aims to fix this by deriving skb->protocol
> from the gso_type. But unfortunately for UDP it unconditionally
> selects ipv4, which will cause drops for UDP over ipv6.

Suggested fix at http://patchwork.ozlabs.org/patch/1044429/

      reply	other threads:[~2019-02-19  4:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 17:15 [PATCH net] net: validate untrusted gso packets without csum offload Willem de Bruijn
2019-02-15 17:36 ` Eric Dumazet
2019-02-16  4:31 ` David Miller
2019-02-18 19:12 ` Willem de Bruijn
2019-02-19  4:40   ` Willem de Bruijn [this message]

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='CAF=yD-+vcfsWMWuHxDuR_V5J7FFLjzCc=1LQkO_zt7HMzWXQAQ@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jasowang@redhat.com \
    --cc=maximmi@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=syzkaller@googlegroups.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;
as well as URLs for NNTP newsgroup(s).