Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp14187241ybl; Mon, 30 Dec 2019 05:41:55 -0800 (PST) X-Google-Smtp-Source: APXvYqyqRuZJG5S11wy4j/gEETrnhCVCEyiceviNxEw85SDrzMRkg7TVqoWt3VELsMWyzWdqhCAV X-Received: by 2002:a9d:7519:: with SMTP id r25mr64786218otk.284.1577713315039; Mon, 30 Dec 2019 05:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577713315; cv=none; d=google.com; s=arc-20160816; b=oM6VOYC3GS3bSTATP47s//N9EhNoekHt4v6bGyTRPTXkQv+YGEfUoaTOSRmAvlhBs+ 2FPnoume79iWgg87uBXDbOcbBBm7hIFU1M+r8dZdgbhSpqz0QMn/U7majFCi5ZNcDWOY Qrr5ePGogEX5j5vpf/A+dvPxVlnyVIUQ93ipOu0L9NBZx0aBGZ4Ne4CgDxMe5C/dywj/ jGHwGFJh1SxKSCEa3uSQXVCw36oLvegbq6xqmfIcQKPwXhhPBU4H3DxIgzBqFgOaplZS t3ByaULL9YtEgWWisUTKrQ0DfcVyZdLlW9mzXsKkr1fTaxqm9TtuO6DSdAWvK6wcsh/k qP7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IGzPYKUVu3c/nY8lDHX/WpdNFa7rqqFtVUQ1GhvvgzI=; b=yHswS9mS/hmEVFror/Iz5qLB6J1C8tGmab9cvuvrTiHhYPTdQQ9POwi5fPPuQWT3nC g/SmT1pjPOkAnSvmIO7L01dMS9mgi8EgjlnboFKlDrsb5IEkhMovxG+Kv+vhezA0zx4v +iCasjYaAYq6xhzKJsjiGWwsCS5/eJz63DIVniE/Fdx7EG00l66lwiI+UhNVGAM5JJcO P48amc4W2l2x137pTZU9Ur3p7Ulf5RdBs2unA5WsOL+tek9q2A8Cjh/3aYEyiB0TLMU3 ceInsx8XZy5qf/vN4/H1pCYuu9rtJTynBcyMFi1IgJsmRuWW4Bf6KFSFidkvGvZfGe6X VEKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HMOl0NfU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si22423336otq.68.2019.12.30.05.41.43; Mon, 30 Dec 2019 05:41:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HMOl0NfU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727515AbfL3NlC (ORCPT + 99 others); Mon, 30 Dec 2019 08:41:02 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:34427 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727445AbfL3NlB (ORCPT ); Mon, 30 Dec 2019 08:41:01 -0500 Received: by mail-yw1-f68.google.com with SMTP id b186so14093502ywc.1 for ; Mon, 30 Dec 2019 05:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IGzPYKUVu3c/nY8lDHX/WpdNFa7rqqFtVUQ1GhvvgzI=; b=HMOl0NfUe59KNPwN3rupWGM8NTgeAGnLbF8B+75zNeLMinYwPYyBGeTiOYeEfBVG8U 8bsaODv1BEVilvRyBhNKYAnUXCFYZzo/l1I+PHjKoQEex2+6LFdna+PwZT9Fweb4KlLs KtJQMtABuZ6+SnNhJgkazDVzycJHeln59myv+yix7QHE8Du9dGXmylFtJEW0y4ok4TfY TZ93Hat0NzifmKpnoP6A1XRxxrxzs2cTNi5Ha6jz9qGWQctBkTQ4n2Mxay5/sIMim2+B bRaSX3R9XCtrQw7qoowBaiN7ma3GLoYhhQp7RaT/87JgHX4n0VkIFd/JNGtdfu4I4yjT Cvog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IGzPYKUVu3c/nY8lDHX/WpdNFa7rqqFtVUQ1GhvvgzI=; b=qvM+ZaeUO4Di66qG46JnO8S4hpnSBxthkbno6yjNsMPfoU6GkYyLqoydySXK6MiI7V 9yRcOTYoOZYqEoN4WSY0uW3TH9rkkNPXU1K7aL1I74k4OR/V+9A6UQk6Q9IU5Cg7glaU swLvpmAgYG+eebW2j3XVVPM5awOzw7mHJ8pZL2vZQQxOaKG7OaEpn3w857EVo5Y0lTQO uF6TRSrrxN7YD5h2mMnS1RFD/BR9E/ic67aNRfihL2aPOUucQqS25PHARtPXZggKdQ8+ GPY+etFAN56UVh8h9GQDXiz3g3xTub13C3H4FTcj4z6S6RUhzTky9fklbctG0yCyiXX1 gpyA== X-Gm-Message-State: APjAAAVqvRVT5dcWe4q2j1ygB2rqTq4GbbGC0teEnP9caVsp9JEifxAM dQp/N948BPsUvHASq7iR3MEUV/cnnDg+OJKD5jU3Rg== X-Received: by 2002:a0d:dd56:: with SMTP id g83mr47756883ywe.174.1577713260439; Mon, 30 Dec 2019 05:41:00 -0800 (PST) MIME-Version: 1.0 References: <1577699681-14748-1-git-send-email-yangpc@wangsu.com> In-Reply-To: <1577699681-14748-1-git-send-email-yangpc@wangsu.com> From: Eric Dumazet Date: Mon, 30 Dec 2019 05:40:49 -0800 Message-ID: Subject: Re: [PATCH] tcp: fix "old stuff" D-SACK causing SACK to be treated as D-SACK To: Pengcheng Yang Cc: David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , andriin@fb.com, netdev , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 30, 2019 at 1:55 AM Pengcheng Yang wrote: > > When we receive a D-SACK, where the sequence number satisfies: > undo_marker <= start_seq < end_seq <= prior_snd_una > we consider this is a valid D-SACK and tcp_is_sackblock_valid() > returns true, then this D-SACK is discarded as "old stuff", > but the variable first_sack_index is not marked as negative > in tcp_sacktag_write_queue(). > > If this D-SACK also carries a SACK that needs to be processed > (for example, the previous SACK segment was lost), What do you mean by ' previous sack segment was lost' ? this SACK > will be treated as a D-SACK in the following processing of > tcp_sacktag_write_queue(), which will eventually lead to > incorrect updates of undo_retrans and reordering. > > Fixes: fd6dad616d4f ("[TCP]: Earlier SACK block verification & simplify access to them") > Signed-off-by: Pengcheng Yang > --- > net/ipv4/tcp_input.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index 88b987c..0238b55 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -1727,8 +1727,11 @@ static int tcp_sack_cache_ok(const struct tcp_sock *tp, const struct tcp_sack_bl > } > > /* Ignore very old stuff early */ > - if (!after(sp[used_sacks].end_seq, prior_snd_una)) > + if (!after(sp[used_sacks].end_seq, prior_snd_una)) { > + if (i == 0) > + first_sack_index = -1; > continue; > + } > > used_sacks++; > } Hi Pengcheng Yang This corner case deserves a packetdrill test so that we understand the issue, can you provide one ? Thanks.