Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3867195rdg; Wed, 18 Oct 2023 08:13:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENzAcGK2mnU/Btr96VXpMzVtHi+0O5YkMy2ZYYQfftvPzfl0bt2LzrHMFTe4bre86hEKCc X-Received: by 2002:a05:6a00:1a12:b0:690:c75e:25c8 with SMTP id g18-20020a056a001a1200b00690c75e25c8mr5630081pfv.7.1697641995218; Wed, 18 Oct 2023 08:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697641995; cv=none; d=google.com; s=arc-20160816; b=QxbOSGeUAP+VFImnhFvL6s7C1/upVWo4u+nluMBj15Qgv2vITpXsyKy1deNoUm0Egu 4CNFM+8vPKGIRvLx3O/wQOODYRicB8HDrHP95Yx2Xx7zpjminVxXDckX0afpVevPDJ8s 2h4a1B+arryI5Xpb661VHdTMyJViid1e/BqrtMJlKjDt36v354GLr7RvgMTxViV4lVZO g9BOrNVv5YKyvdVaX4AHxRjjE3E1GBmFFaD66e55fDx4PR18MiiV+mTk8QQ3h3wk6JYh ylttpKqSsy82RhHIzAe7dKZQk78oK5g/HIYZVrdrMzdpR6bNRGhZUZ0V8WIL+6d4Lp9e bbDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=XWbCD44fa8QVirKg52i0pJ2hVvUN78k4QH9nUIrzJHg=; fh=q0yfU05EOr+7osON5MNPy7fJqZ5tLhzTIlGJQLCwoRY=; b=bQQxI30oLtJQpyNCCXnpnix+Yu+nmXMZmSu0M+uLBu8B6zoneN9tpT8foIurnA7qSK OuT0Ehyz62iQ4EkK0LTjQSeiP4DpI2yu8TJCAYWb1loxHrM+4+6FvQyzap9Vb02QHqOp 9kMmqNLgQFP34gj3IGPCkjhWft9hFBWeNWR31trsu9bCGyV0ukvK2c5EZGATlbLHiPxk 5402NMGVd/Vc9eCrvwma4Rwe6OJS0IrHKfPlZ5HNWUILrrQ1bW10VrYoTulaFxiNWJWs rcsz4TIi7kNzUVH+Bvo5sjzquRiclpoYA6cILtK0pDUCXhTBovjFh7f1GgRbAeXFhqhD qSQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GL9uRMXn; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l65-20020a633e44000000b00584d3c90592si2369757pga.411.2023.10.18.08.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:13:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GL9uRMXn; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 96969802922D; Wed, 18 Oct 2023 08:13:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345150AbjJRPNC (ORCPT + 99 others); Wed, 18 Oct 2023 11:13:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235063AbjJRPNA (ORCPT ); Wed, 18 Oct 2023 11:13:00 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC63EA for ; Wed, 18 Oct 2023 08:12:59 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697641977; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XWbCD44fa8QVirKg52i0pJ2hVvUN78k4QH9nUIrzJHg=; b=GL9uRMXnFSpPUnyQNAWR7y2CRX+ET2BiPsHirmg3JfZFt+XKLeq9cdmHVUkI/110VEtK4Q pgmlehtrcyBA02gLsQE7HSv4QBwWBLKZxw6TmyxEtQwaHoWtq4IEFs2dgfzPGNtFOmqMPL 52ys2nP9mZ9XxWwdEfvB0K3Nlt3UGwe4puHtMmZ7Pa2/MByBtmnnLEwa8lE1jVm1lz7ckW fEA3z1sh4iAmCeNE5isRI1iVu2YKrD4u/+N7TUwhe0rhviRr+7xk+ksvIArHBjrM2BVyR9 IZk/VKcfgCxVIRDEObsJavElEWWtHLl2YXf7eUbhtwqYPmYXwVILQBbPjvufNg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697641977; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XWbCD44fa8QVirKg52i0pJ2hVvUN78k4QH9nUIrzJHg=; b=FwbseROgTqJr+slcTXr6QCw5kB9AwpvNLuGlrlaWhPiaxUFmDaCblnY5WR9SdZp5svE8+c Hf1y5Ht4/GfeDqCA== To: Eric Dumazet , gus Gusenleitner Klaus , Noah Goldstein Cc: lkml , Ingo Molnar , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "David S. Miller" , "dsahern@kernel.org" , "kuba@kernel.org" , Paolo Abeni , Al Viro Subject: Re: [PATCH] amd64: Fix csum_partial_copy_generic() In-Reply-To: References: Date: Wed, 18 Oct 2023 17:12:57 +0200 Message-ID: <87h6mo3qx2.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 08:13:12 -0700 (PDT) On Wed, Oct 18 2023 at 09:36, Eric Dumazet wrote: > On Wed, Oct 18, 2023 at 8:18=E2=80=AFAM gus Gusenleitner Klaus wrote: >> >> The checksum calculation is wrong in case of an source buffer >> containing zero bytes only. The expected return value is 0, the >> actual return value is 0xfffffff. >> >> This problem occurs when a ICMP echo reply is sent that has set >> zero identifier, sequence number and data. >> >> Signed-off-by: Klaus Gusenleitner >> --- >> arch/x86/lib/csum-copy_64.S | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/x86/lib/csum-copy_64.S b/arch/x86/lib/csum-copy_64.S >> index d9e16a2cf285..c8391b4f3dea 100644 >> --- a/arch/x86/lib/csum-copy_64.S >> +++ b/arch/x86/lib/csum-copy_64.S >> @@ -44,7 +44,7 @@ SYM_FUNC_START() >> movq %r13, 3*8(%rsp) >> movq %r15, 4*8(%rsp) >> >> - movl $-1, %eax >> + movl $0, %eax I don't think this is correct. See below. >> xorl %r9d, %r9d >> movl %edx, %ecx >> cmpl $8, %ecx >> -- >> 2.30.2 >> > > Lets CC Noah Goldstein (I thought Noah wrote > some kunit tests, maybe I am wrong) > > When was this bug added ? AFAICT, this was introduced with: daf52375c19f ("amd64: switch csum_partial_copy_generic() to new calling con= ventions") > A Fixes: tag is very much needed, and would be a needed step to CC the > original author. Cc'ed Al. So the change in question is: - movl %ecx, %eax // Original code stores ECX in EAX + movl $-1, %eax // EAX is preset with -1 ECX (RCX) was the 4th parameter of the original ASM function call: extern __visible __wsum csum_partial_copy_generic(const void *src, const vo= id *dst, int len, __wsum sum, int *src_err_ptr, int *dst_err_ptr); I.e. it handed @sum into the function which means a caller provided seed. With the above patch the ASM function call was changed to extern __visible __wsum csum_partial_copy_generic(const void *src, void *ds= t, int len); I.e. the seed parameter was removed. AFAICT, all callers back then initiali= zed the seed parameter to 0 via the various wrapper interfaces which end up the= re. Al? Thanks, tglx