Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp251462rdb; Thu, 19 Oct 2023 03:36:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6loqWnd4W01xIkz0VIC/Q+27DbxZUjV6XuVw3abNIixheX8i41BupO4+heqdZqN3uGG2w X-Received: by 2002:a05:6a20:9151:b0:151:35ad:f327 with SMTP id x17-20020a056a20915100b0015135adf327mr1768273pzc.17.1697711788753; Thu, 19 Oct 2023 03:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697711788; cv=none; d=google.com; s=arc-20160816; b=IIJXjkt6CSmKdlyrww/j977L8k3iWOulS7jQuey6AwlawicTUIkvwXvC6GFiQbXsXK QcxohLlTVm1a3gwZOzwQhhrpENrfhhMbECB/Mh3HDNsIwya0Vq1GFg9OGr/xqrrvm6f4 /HYbC/Q1LA9FU0xFjqlGWRZwLAZNLsJxupykzsA7OdNK37XikObQoVQpE+1T7tBKGdc1 Nj4RilLD1vCJyh70LR2KpRh8aMANGbYCNhUNU5DFtZSbKfnjNHEhHhxgBm2IIm9gvfg6 1JPFzMjcxuzTJeJmuuLPr/lTrUXbFY5EAwjyup/2OOE5kllqbJMG9kmD1vir7qM3kk/1 LliA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:msip_labels:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from; bh=U/vbP8UBng4W1DKBhnWIMC1gltqjaC99I/3M/ZNCvGI=; fh=EPMdWujTtO3H8CssaDyZiAyCOlMEXn+2LFs1xndLgHc=; b=ILYcaJbQG7rv0rwXD9IMEcX70nZTmyZUqF2+AiCb0ncITjY4m8TvFICNFAduZpSTMD Smt/Ufc1D5P7p4RZd+LreRY/AJjEMEsUHxZiO+4e8aQnF1Frgr78iLjRQMhKXjjFQPI2 Mq2OMBo4P34zJ08cJtuc+wXthqC1VxkEDh2nmFGCDOMr+bril/45STfgTg7CWJ7vVCqp gDC4TV0ahLXOe3r22g7szfeNN0SUjkKJbrUfaFp/yYUdBt03/JdQ5GmTT2vF7aAJw+/I ZQqcUbjpmnUDQ95vPTExiPdkVDvMpxwmk7/MkZ5HhPfYROrhxOqJs8VKG0gnkzwI6jgj m4/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u11-20020a17090282cb00b001ca4dd7b834si1826666plz.309.2023.10.19.03.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 03:36:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id ADDF5826EC4E; Thu, 19 Oct 2023 03:36:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbjJSKgV convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 Oct 2023 06:36:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbjJSKgU (ORCPT ); Thu, 19 Oct 2023 06:36:20 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F304D123 for ; Thu, 19 Oct 2023 03:36:17 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mtapsc-5-Z1Yi8b17Pr6wQkjS_sMyLQ-1; Thu, 19 Oct 2023 11:35:35 +0100 X-MC-Unique: Z1Yi8b17Pr6wQkjS_sMyLQ-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 19 Oct 2023 11:33:50 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Thu, 19 Oct 2023 11:33:50 +0100 From: David Laight To: 'gus Gusenleitner Klaus' , Al Viro , Thomas Gleixner CC: lkml , Ingo Molnar , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "David S. Miller" , "dsahern@kernel.org" , "edumazet@google.com" , "kuba@kernel.org" , Paolo Abeni Subject: RE: [PATCH] amd64: Fix csum_partial_copy_generic() Thread-Topic: [PATCH] amd64: Fix csum_partial_copy_generic() Thread-Index: AdoBilvmES7GiG9dTkSxSspB8XHmAgAT0kuAABppQjAADK2L0A== Date: Thu, 19 Oct 2023 10:33:50 +0000 Message-ID: References: <20231018154205.GT800259@ZenIV> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f7ce15f3-f9cf-4fe0-be64-c49742693951_ActionId=4aed22ee-49cb-451e-8335-840086e98737;MSIP_Label_f7ce15f3-f9cf-4fe0-be64-c49742693951_ContentBits=0;MSIP_Label_f7ce15f3-f9cf-4fe0-be64-c49742693951_Enabled=true;MSIP_Label_f7ce15f3-f9cf-4fe0-be64-c49742693951_Method=Standard;MSIP_Label_f7ce15f3-f9cf-4fe0-be64-c49742693951_Name=Confidential;MSIP_Label_f7ce15f3-f9cf-4fe0-be64-c49742693951_SetDate=2023-10-19T04:18:19Z;MSIP_Label_f7ce15f3-f9cf-4fe0-be64-c49742693951_SiteId=83e2508b-c1e1-4014-8ab1-e34a653fca88 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 19 Oct 2023 03:36:26 -0700 (PDT) > Wireshark shows a bad checksum warning: > 'Checksum: 0x0000 incorrect, should be 0xffff' Does the ICMP message contain the non-inverted checksum? Usually it is inverted before transmission so that a checksum of the whole buffer (including the checksum) is 0xffff. If the checksum() function does the reduction mod 0xffff with 'add with carry' it is only zero if the buffer is zero. So initialising to 0xffff does make sense. OTOH the value could be reduced using 'csum64 % 0xffff' which generates 0x0 not 0xffff (and might be faster code). There is a different potential issue that IPv6 mandates a non-zero checksum field. But a naive ~checksum(buffer, len) can generate zero. The simple fix is to initialise the checksum with 1 and add 1 back after the invert so: buffer->csum = ~checksum(1, buffer, len) + 1; I'm guessing the current code has an extra conditional in the hot path? David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)