From: Eric Dumazet Subject: Re: RFC: Dropping duplicate fragments as overlapping? Date: Wed, 12 Dec 2018 06:32:52 -0800 Message-ID: <8ea4cf18-cdae-73b1-4999-6351f1d0a47d@gmail.com> References: <20181212141155.GD21324@unicorn.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Peter Oskolkov , Gustavo Figueira To: Michal Kubecek , netdev@vger.kernel.org Return-path: Received: from mail-wr1-f54.google.com ([209.85.221.54]:34056 "EHLO mail-wr1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726246AbeLLOc4 (ORCPT ); Wed, 12 Dec 2018 09:32:56 -0500 Received: by mail-wr1-f54.google.com with SMTP id j2so17948810wrw.1 for ; Wed, 12 Dec 2018 06:32:56 -0800 (PST) In-Reply-To: <20181212141155.GD21324@unicorn.suse.cz> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 12/12/2018 06:11 AM, Michal Kubecek wrote: > Hello, > > one of our customers started seeing NFS failures since updating to > a kernel with "FragmentSmack" fixes. > > They are using a weird setup abusing "broadcast" mode of bonding so that > each packet between some hosts is duplicated. Commit 7969e5c40dfd ("ip: > discard IPv4 datagrams with overlapping segments.") identifies duplicate > IPv4 fragments as "overlapping" and drops the whole queue so that > fragmented packets are never delivered unless the reassembly is > completed before any of the dupplicates arrives. > > We have verified that modifying the reassembly code to check if start > and length of newly received fragment match the earlier one and only > drop the new fragment in such case resolves their issue. But I don't > find such solution desirable for two reasons: > > 1. IPv6 reassembly code always dropped the packets on receiving > a duplicate fragment and one can interpret RFC 5722 to actually require > us to. (I'm not completely sure as RFC 5722 doesn't seem to define what > is meant by "overlapping".) In any case, there seem to be no complaints > about that. > > 2. The purpose of commit 7969e5c40dfd is to prevent an attacker from > overloading the reassembly code by forcing it to look up large numbers > of random fragments of a packet which is never going to be completed. > With the change indicated above, the attacker still could send a lot of > copies of the same fragment (carefully prepared to maximize the CPU time > spent by lookup) so that the commit would become effectively useless. > (We would not need to handle handling the overlapping fragments but it > still does not feel like something we would want.) > > On the other hand, the customer is kind of right that their setup, > however insane, used to work and it does not work any longer which is > a regression from their point of view. > > The question I would like to discuss is: is dropping all packets with > duplicate fragments an acceptable loss for the "FragmentSmack" > mitigation? Or the other way around: would the regression (which was > AFAIK only encountered as a result of a misconfiguration) justify > weakening the "FragmentSmack" mitigation? > > Michal Kubecek > Oh nice catch. I believe we must accept duplicate fragments, this can happen on some bonding setups as you described. The patch was about overlapping segments, which is a different case, so we probably need a fix, this should not be too difficult. Thanks for the report !