Return-Path: Received: from shards.monkeyblade.net ([184.105.139.130]:48164 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933978AbeB1P4Y (ORCPT ); Wed, 28 Feb 2018 10:56:24 -0500 Date: Wed, 28 Feb 2018 10:56:22 -0500 (EST) Message-Id: <20180228.105622.1054351882596152165.davem@davemloft.net> To: dja@axtens.net Cc: netdev@vger.kernel.org, daniel@iogearbox.net, alexei.starovoitov@gmail.com Subject: Re: [PATCH 5/6] net: add and use helpers when adjusting gso_size From: David Miller In-Reply-To: <20180227130407.22498-6-dja@axtens.net> References: <20180227130407.22498-1-dja@axtens.net> <20180227130407.22498-6-dja@axtens.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: From: Daniel Axtens Date: Wed, 28 Feb 2018 00:04:06 +1100 > An audit of users of gso_size reveals that an eBPF tc action on a > veth pair can be passed an SCTP GSO skb, which has gso_size of > GSO_BY_FRAGS. > > If that action calls bpf_skb_change_proto(), bpf_skb_net_grow() > or bpf_skb_net_shrink(), the gso_size will be unconditionally > incremented or decremented to some nonsense value. > > Add helpers that WARN if attempting to change a gso_size of a > GSO_BY_FRAGS skb (and leave the value unchanged). > > Signed-off-by: Daniel Axtens We can't really do this. It means that a user loaded eBPF program can trigger logs full of warnings merely by using this eBPF helper and generating GSO'd SCTP traffic. Daniel and Alexei, this is a serious problem. The eBPF helpers mentioned here cannot handle SCTP GSO packets properly, and in fact corrupt them if they adjust the gso_size. SCTP GSO packets use the GSO_BY_FRAGS scheme and cannot be treated the same way we treat normal GSO packets.