Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp904882rdb; Wed, 6 Dec 2023 03:27:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IF35NB9vEByywZNGJmotMDslkA2vuryjqJA/zNJ7DcrltQkcIePfh7l4bcL+NtmAmTAWm5i X-Received: by 2002:a17:90a:4ce3:b0:288:76d7:4227 with SMTP id k90-20020a17090a4ce300b0028876d74227mr237745pjh.52.1701862020056; Wed, 06 Dec 2023 03:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701862020; cv=none; d=google.com; s=arc-20160816; b=JeKHIksmLQYixhnZLqQnWfO7nb01uol5Bnt+HBxYeawV3HBSJBmQwbVjkgP++F53VE f5daEFbgyQiGmQGfqI12vQ2hjJbdVqlrNgZtrHf3b0SLxQzhzeTFsrT6q+HS09MlOvw/ SLzLeKdxe/uWPTY9dIqLrJh7VwRpSRF6dUS4b5nRHaMH5+/y4oL/3LHQc/zRE6dW525G NUtjttLV7IIslcamMyFd9XvZ3nTmgEulhhechDTXm8hedpcrwziAh4PUaZLK3y8AIbyb uzLkW+uTekYspaWBJ62IgAC0XrkfCtUKKQexQ7j3aG/oAj43cdal6pGqQ5DuOYQL5TF7 oJrA== 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:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=Cpx9ll9oBIahzKMisn5qpgiovNfKVvGob0CiTcpEn+s=; fh=ScCjLhg2Mv3okBPRjkPrrsg8OzhvutnYPYwt3WASYdg=; b=iRDINiCL2o8sd/rNJCCp9P8F7paw2rRFuvTy5SMhGBtWDIY8c87UJqLH0Drq14nqh2 IJjTEcepj7QDUDLwRb9X6LSAZNar8TxepYMaVrmdf8yvpeYlfQYaa3sHwEKvG9ZSYCoH asG/w0m2wLycYvvoqvIfrC7OZcY5NwAr/DOEfmTZz/mvD3DkVdgqHDtbXbYqqp/+OPyI B53bMVjVDQRe5lo4BHY9xET6/rmeHJNJ30pc8+M0+7lKvsQAhfLNz0+BsERUAnXIetjK LhaJAAyVeK/HMhrdMDfzv7akHrTPsAh9Tzc2nhrdzaDfsFCeq1YEvnZ4M+2xh6tdTYYk yP2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id lk16-20020a17090b33d000b00286ce76ff01si3825097pjb.146.2023.12.06.03.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 03:27:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id A269380321EE; Wed, 6 Dec 2023 03:26:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377514AbjLFL0l convert rfc822-to-8bit (ORCPT + 99 others); Wed, 6 Dec 2023 06:26:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378092AbjLFLK6 (ORCPT ); Wed, 6 Dec 2023 06:10:58 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5241D42 for ; Wed, 6 Dec 2023 03:11:03 -0800 (PST) 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-mta-4-2hKIkG_FPuSAvM53S8Wr_w-1; Wed, 06 Dec 2023 11:10:59 +0000 X-MC-Unique: 2hKIkG_FPuSAvM53S8Wr_w-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 6 Dec 2023 11:10:45 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 6 Dec 2023 11:10:45 +0000 From: David Laight To: 'Al Viro' , "linux-arch@vger.kernel.org" CC: gus Gusenleitner Klaus , Al Viro , Thomas Gleixner , lkml , Ingo Molnar , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "David S. Miller" , "dsahern@kernel.org" , "kuba@kernel.org" , Paolo Abeni , Eric Dumazet Subject: RE: [RFC][PATCHES v2] checksum stuff Thread-Topic: [RFC][PATCHES v2] checksum stuff Thread-Index: AQHaJyGyb9WP/snuGU2gdqpp5IxoMLCcGsYA Date: Wed, 6 Dec 2023 11:10:45 +0000 Message-ID: <602ab11ffa2c4cc49bb9ecae2f0540b0@AcuMS.aculab.com> References: <20231018154205.GT800259@ZenIV> <20231019050250.GV800259@ZenIV> <20231019061427.GW800259@ZenIV> <20231019063925.GX800259@ZenIV> <20231019080615.GY800259@ZenIV> <20231021071525.GA789610@ZenIV> <20231021222203.GA800259@ZenIV> <20231022194020.GA972254@ZenIV> <20231205022100.GB1674809@ZenIV> In-Reply-To: <20231205022100.GB1674809@ZenIV> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 06 Dec 2023 03:26:57 -0800 (PST) From: Al Viro > Sent: 05 December 2023 02:21 > > We need a way for csum_and_copy_{from,to}_user() to report faults. > The approach taken back in 2020 (avoid 0 as return value by starting > summing from ~0U, use 0 to report faults) had been broken; it does > yield the right value modulo 2^16-1, but the case when data is > entirely zero-filled is not handled right. It almost works, since > for most of the codepaths we have a non-zero value added in > and there 0 is not different from anything divisible by 0xffff. > However, there are cases (ICMPv4 replies, for example) where we > are not guaranteed that. > > In other words, we really need to have those primitives return 0 > on filled-with-zeroes input. Do we? I've not seen any justification for this at all. IIRC the ICMPv4 reply code needs the checksum function return 0xffff for all-zero input. So the correct and simple fix is to initialise the sum to 0xffff in the checksum function. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)