From: Jason Wang Subject: Re: [PATCH net] gso: validate gso_type if SKB_GSO_DODGY Date: Thu, 18 Jan 2018 17:14:25 +0800 Message-ID: References: <20180117231126.223033-1-willemdebruijn.kernel@gmail.com> <490b9e34-001b-6287-82b6-a839a9a834e7@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Network Development , David Miller , Eric Dumazet , Willem de Bruijn , Vlad Yasevic To: Willem de Bruijn Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46056 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754872AbeARJOa (ORCPT ); Thu, 18 Jan 2018 04:14:30 -0500 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 2018年01月18日 14:04, Willem de Bruijn wrote: > On Thu, Jan 18, 2018 at 12:20 AM, Willem de Bruijn > wrote: >> On Wed, Jan 17, 2018 at 10:48 PM, Jason Wang wrote: >>> >>> On 2018年01月18日 07:11, Willem de Bruijn wrote: >>>> From: Willem de Bruijn >>>> >>>> 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