Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F8A9C282C3 for ; Wed, 23 Jan 2019 02:49:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4860C217F5 for ; Wed, 23 Jan 2019 02:49:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WVGfaMmC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726961AbfAWCtI (ORCPT ); Tue, 22 Jan 2019 21:49:08 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:44286 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbfAWCtI (ORCPT ); Tue, 22 Jan 2019 21:49:08 -0500 Received: by mail-pl1-f194.google.com with SMTP id e11so350696plt.11 for ; Tue, 22 Jan 2019 18:49:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=d2653A5nFvwiLpUT3XTrEkUId8GPQJj/1a5w+mMUDZ8=; b=WVGfaMmCk9vBHNzYTSFuq1j9jizIjM6jUaIaQl2mU7Ah9+wJvHWDWsUahz7R97N2ml kFKHStN0MVCT3NviWD8QphnyKK9rFnulfIr+cvjZNOxFu/eYcXrdOH/dFHfsMW8pfsoi YclKPAViRbyEMz3NBIhUiYJKHc/zzXY+9IvFDc6OegYJHYIWArwmz1bNEFXSQ2lX0+b8 PRhcLiObSDGIRGGiBvIyZOZvRH1mJZ6VoeOSCRu0zCZnvBIBczN7IvosTMp+9MfgYitX 7QKJhJgSXBtaR3lZSTXJsECaMrYBwLQtfMikfP/hZP+Q6G+JRhKQga8W0J6tbb1EoxCy F6mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=d2653A5nFvwiLpUT3XTrEkUId8GPQJj/1a5w+mMUDZ8=; b=dn1CttLDjuVk239sN4u7KRY4DA3Fwy/w/jgTXxoSRkVAXyAtownxDBdaUtm1iaGUOe Kl1Sb0CunV3F5COvSzkaL4HH4V+t4IZ+hJjRvADWiidcy9XLW3R9U4u0lT94zCmmDu99 G4Esb8+6wTDxP0p7iNB3weyvMomJHj/Fk1HpW607FQLFoMpMWX7T3YVS/seYr9Zed/CJ ajmnB79GO7LqtSFYNlThZZtonEKPeIjlShGBu7tuu4QCek03Rq+tPmq5GH+Tn95WGftu cDLXttxP9NmN0eBugMi615zhTTIuoAlRMWN8nQhUrzWQ+fspEmVmbnv7YQEkcV0GGCxc OAfQ== X-Gm-Message-State: AJcUukflVnQ+H4bEF2bNw3T7tNfiIv/DzaWFx6P+Srk9gP7ViDgRVzBX xR9BfKd7joVoB9fDyyGWOOo= X-Google-Smtp-Source: ALg8bN5VmQAPPIeXDsvgswn1JRT341RvscBwDtSrWAywuMwsRB0u/34oIIn8Xj7Bpr5WniPpmHj9RA== X-Received: by 2002:a17:902:346:: with SMTP id 64mr459735pld.337.1548211747825; Tue, 22 Jan 2019 18:49:07 -0800 (PST) Received: from [192.168.86.235] (c-73-241-150-70.hsd1.ca.comcast.net. [73.241.150.70]) by smtp.gmail.com with ESMTPSA id n78sm34820898pfk.19.2019.01.22.18.49.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 18:49:06 -0800 (PST) Subject: Re: [PATCH net-next 2/4] net: IP6 defrag: use rbtrees for IPv6 defrag To: Tom Herbert , Peter Oskolkov Cc: David Miller , Linux Kernel Network Developers , Peter Oskolkov , Eric Dumazet , Florian Westphal References: <20190122180253.128336-1-posk@google.com> <20190122180253.128336-3-posk@google.com> From: Eric Dumazet Message-ID: <028b82d0-aff3-0197-69c0-b450e1cb1643@gmail.com> Date: Tue, 22 Jan 2019 18:49:05 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 01/22/2019 06:13 PM, Tom Herbert wrote: > On Tue, Jan 22, 2019 at 5:13 PM Peter Oskolkov wrote: >> >> On Tue, Jan 22, 2019 at 5:04 PM Tom Herbert wrote: >>> >>> On Tue, Jan 22, 2019 at 4:53 PM Peter Oskolkov wrote: >>>> >>>> On Tue, Jan 22, 2019 at 4:37 PM Tom Herbert wrote: >>>>> >>>>> On Tue, Jan 22, 2019 at 10:03 AM Peter Oskolkov wrote: >>>>>> >>>>>> Currently, IPv6 defragmentation code drops non-last fragments that >>>>>> are smaller than 1280 bytes: see >>>>>> commit 0ed4229b08c1 ("ipv6: defrag: drop non-last frags smaller than min mtu") >>>>>> >>>>> Peter, >>>>> >>>>> I'm a bit confused on why so much code is required to undo this patch >>>>> which was a whole three lines of code to begin with. >>>> >>>> I agree that if the goal is to just lower the 1280 IPv6 fragment >>>> limit, but keep it reasonably high, then my patchset is not needed. >>>> However, if the decision (ultimately by David Miller, I guess) is to >>>> accept fragments of any size, as the standard seems to imply, then >>>> something similar to what I suggested here is needed, I think. This >>>> was done in IPv4... >>> >>> Peter, >>> >>> Sorry, I'm still not following. Before "ipv6: defrag: drop non-last >>> frags smaller than min mtu" wouldn't we have accepted fragments of any >>> size? Are you saying that things were previously broken otherwise? >> >> Yes, before the patch you reference above, fragments of any size had >> been accepted. And this had been identified as a DDOS threat and >> mitigated in IPv6 by setting the 1280 fragment limit and in IPv4 by >> using rbtrees. The IPv4/IPv6 difference was due to the belief, at the >> time, that IPv6 standard actually required non-last fragments less >> than 1280 to be dropped, while IPv4 standard required accepting >> fragments of any size. >> >> So things were broken in the sense of having this DDOS vulnerability, >> and the vulnerability was fixed in IPv4 and IPv6 using different >> approaches... > > I see, thanks for the explanation! Even if there is a limit on > fragment size, it should be configurable so your patches would still > be relevant. As for eliminating the limit completely, I think that > question is what is the remaining DOSability with a tiny fragment > attack. Have you done any analysis that might shed light on that? > Given that we have no limit for IPv4, IPv6 should behave the same. We already have memory limits, so the rbtree handling make sure any incoming fragment will find the insertion point in O(log2(N)), which is good enough, even if N is around 8000.