On 2018年01月18日 14:04, Willem de Bruijn wrote:
On Thu, Jan 18, 2018 at 12:20 AM, Willem de Bruijn
<willemdebruijn.ker...@gmail.com> wrote:
On Wed, Jan 17, 2018 at 10:48 PM, Jason Wang <jasow...@redhat.com> wrote:

On 2018年01月18日 07:11, Willem de Bruijn wrote:
From: Willem de Bruijn<will...@google.com>

Validate gso_type of untrusted SKB_GSO_DODGY packets during
segmentation.

Untrusted user packets are limited to a small set of gso types in
virtio_net_hdr_to_skb. But segmentation occurs on packet contents.
Syzkaller was able to enter gso callbacks that are not hardened
against untrusted user input.

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

This commit is suspicious, I guess it should be 5c7cdf339af5 ("gso: Remove
arbitrary checks for unsupported GSO")
The specific SCTP path was introduced with commit 90017accff61 ("sctp:
add GSO support"). But the main issue that packets can be delivered to
gso handlers different from their gso_type goes back further.

The commit you reference is actually older than the sctp gso patch, so
it makes sense that it did not have a check in the sctp_gso_segment.

I still think that we should check in inet_gso_segment when we have
the proto, instead of in each {tcp, sctp, udp, esp, ...} handler having
a check of the form.

       !(type & (SKB_GSO_TCPV4 |
         SKB_GSO_TCPV6))))
Unless we can create packets that legitimate combine
SKB_GSO_DODGY with tunnel headers.

As you mentioned below, looks like we can e.g bridge between tunnels (vxlan, gre or others) and tap, or even bpf can produce this (e.g bpf_skb_adjust_room).


virtio_net_hdr_to_skb does not accept tunneled gso types.

Yes, Vlad is trying to extend virtio to support more kinds of gso types, so it will be supported for sure.


But a tun device can be bridged with a gre tunnel in the
host, creating a path that will call gre_gso_segment.

If that is possible, then this patch is indeed too strict and
we do need checks in the individual handlers.

I think so.

Thanks

Reply via email to