From patchwork Thu Nov 2 19:30:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 833513 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fvVWbn+N"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ySZtc06ZHz9sMN for ; Fri, 3 Nov 2017 06:30:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934221AbdKBTa3 (ORCPT ); Thu, 2 Nov 2017 15:30:29 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:45759 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934065AbdKBTa2 (ORCPT ); Thu, 2 Nov 2017 15:30:28 -0400 Received: by mail-pf0-f193.google.com with SMTP id d28so423434pfe.2 for ; Thu, 02 Nov 2017 12:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=cMp5LFCob0CbfdJN0Hv9vdsRHywIAzTbCN8jRGZbdMw=; b=fvVWbn+No0EVVGAVqWZ5yr0OqOiSVv/O9zD1/TIXjwfO0IV0FeZSwB4dhE50oYRQCR iMwuMr1OtkcdS1yfhhBRQ94P8dduWbVRkJAZ6wQKEAQhkaHryzQG85tk8vRUasjaVUNn 4Y1QkAzPxvxDGPubqqohrdSJVAI0hypucKZz6gGreO1vhd5IW0tKzxCPGqnMhlc/2ImX 34Rp4Hui6MyIo2yxI2QA8sBauQIJlkbi6VX3H+GnUjltx+CL1eTABHD09bZI6rR8Ho8t 3S2kTWjOAgqFdpkr2H8beyeQr7LZOX9pT2hPzSMr1e+7YSC3nZve7vQLriTL9IjRg7TB cg1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=cMp5LFCob0CbfdJN0Hv9vdsRHywIAzTbCN8jRGZbdMw=; b=UE+ivoUhH3AGXzP9XhIlerbjPrAW4ts+J+uhhyZre37rUKCs2dZ74iGpJGYZRc9cm1 9omDUfAvBDdfsduguAN4CtipepahXe++FIGuO0ehnxNAfGQVBYYGiVD8qt/HtVcuegUr EAZ0Jw9/QCN1pXevPYvHeRKHGUDyXTXFMkUJteMl5+SfMCKYzsOyoG1uXd7PfBvsDTPe vff7oSC5tqDOoV9ftToIq+gkH867cT4HfangNQoW4l+e+++bEKC+h3x2XukLF+FWfIQN jSTxADOz3r3KkCRt2BHXFv0G0u0jvyPcP9qCyDPkMEn9rFYsFa4chCe2PGwoF4bBEslH raLQ== X-Gm-Message-State: AMCzsaU5oYjYf8jMEQaZQmEV1B634eisVw/IQV39yyeEw3qN7SpRYPVa vZZKVFLC1+HDX3tRY/bE4Jg= X-Google-Smtp-Source: ABhQp+ThJSapzCs0NviICZpOA7RnhATDvo7eYksJTrBLIDHQz9vGqciKlNao+1951cvNkmw3ifUMCQ== X-Received: by 10.84.197.131 with SMTP id n3mr4402333pld.227.1509651027579; Thu, 02 Nov 2017 12:30:27 -0700 (PDT) Received: from [192.168.86.171] (c-67-180-167-114.hsd1.ca.comcast.net. [67.180.167.114]) by smtp.googlemail.com with ESMTPSA id h8sm1993490pgq.82.2017.11.02.12.30.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 12:30:26 -0700 (PDT) Message-ID: <1509651025.2849.23.camel@edumazet-glaptop3.roam.corp.google.com> Subject: [PATCH net] tcp: do not mangle skb->cb[] in tcp_make_synack() From: Eric Dumazet To: Christoph Paasch Cc: Eric Dumazet , David Miller , netdev Date: Thu, 02 Nov 2017 12:30:25 -0700 In-Reply-To: <1509589291.2849.1.camel@edumazet-glaptop3.roam.corp.google.com> References: <20171101211001.57901-1-cpaasch@apple.com> <1509573218.3828.54.camel@edumazet-glaptop3.roam.corp.google.com> <20171102001035.GR44287@da0602a-dhcp105.apple.com> <1509584410.3828.64.camel@edumazet-glaptop3.roam.corp.google.com> <1509589291.2849.1.camel@edumazet-glaptop3.roam.corp.google.com> X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet Christoph Paasch sent a patch to address the following issue : tcp_make_synack() is leaving some TCP private info in skb->cb[], then send the packet by other means than tcp_transmit_skb() tcp_transmit_skb() makes sure to clear skb->cb[] to not confuse IPv4/IPV6 stacks, but we have no such cleanup for SYNACK. tcp_make_synack() should not use tcp_init_nondata_skb() : tcp_init_nondata_skb() really should be limited to skbs put in write/rtx queues (the ones that are only sent via tcp_transmit_skb()) This patch fixes the issue and should even save few cpu cycles ;) Fixes: 971f10eca186 ("tcp: better TCP_SKB_CB layout to reduce cache line misses") Signed-off-by: Eric Dumazet Reported-by: Christoph Paasch Reviewed-by: Christoph Paasch --- net/ipv4/tcp_output.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 823003eef3a21a5cc5c27e0be9f46159afa060df..478909f4694d00076c96b7a3be1eda62b6be8bef 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -3180,13 +3180,8 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst, th->source = htons(ireq->ir_num); th->dest = ireq->ir_rmt_port; skb->mark = ireq->ir_mark; - /* Setting of flags are superfluous here for callers (and ECE is - * not even correctly set) - */ - tcp_init_nondata_skb(skb, tcp_rsk(req)->snt_isn, - TCPHDR_SYN | TCPHDR_ACK); - - th->seq = htonl(TCP_SKB_CB(skb)->seq); + skb->ip_summed = CHECKSUM_PARTIAL; + th->seq = htonl(tcp_rsk(req)->snt_isn); /* XXX data is queued and acked as is. No buffer/window check */ th->ack_seq = htonl(tcp_rsk(req)->rcv_nxt);