From: Willem de Bruijn <willemdebruijn.ker...@gmail.com> Date: Fri, 15 Feb 2019 12:15:47 -0500
> From: Willem de Bruijn <will...@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 <syzkal...@googlegroups.com> > Signed-off-by: Willem de Bruijn <will...@google.com> Applied and queued up for -stable, thanks Willem. > This captures a variety of bad gso packets, but to tighten further: > > - drop SKB_GSO_DODGY packets with ipip/sit/.. , which cannot be legal. > by ipip_gso_segment wrappers around inet_gso_segment > expands on 121d57af308d ("gso: validate gso_type in GSO handlers") > > - limit the number of ipv6 exthdrs allowed from dodgy sources. > not sure where to draw the line. but not at 64K ;) > > - validate the network and transport protocol returned in > skb_probe_transport_header against the VIRTIO_NET_HDR_GSO type > > - probe all dodgy GSO packets, also those that set checksum offload. > this will have a performance impact, discussed previously in > http://patchwork.ozlabs.org/patch/861874/ > but it would have blocked this latest bug as well > > All but the last one seem pretty uncontroversial to me. If no one > objects I plan to send those to net-next. No objections from me.