Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1970088rdb; Sun, 11 Feb 2024 05:57:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqw9RSEYCz8v4vkMboXHw/+wBbO+uIFYuho6SjCJolxIDDAdD7JKr2Chi9lfmzlMOVZ+/y X-Received: by 2002:ad4:5d4e:0:b0:681:35b:ff6f with SMTP id jk14-20020ad45d4e000000b00681035bff6fmr7849741qvb.29.1707659866587; Sun, 11 Feb 2024 05:57:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707659866; cv=pass; d=google.com; s=arc-20160816; b=i5Q5aMoWWCOdVkb2LBLPkK7/0yY4zhEbOsDYcjXL/zGYX2AGLG2KMvNEeisWZJAqBY h/hyHR1HHTRJ+hvV3iVUUZ9yBjrqeX3KGRpLGiMDgEEB0IRjaMFjbMvzI7GUXxdWK7IE bOcnSvnwxSVhqkDnGaRuZ41i12p6TM/TIarhpV9CVcCQ2r3eOoBZQvWlXkjjzfAn22M6 AG3bC38PdI6OH+/thWwmqUG/3wFE5UWl1hbxgsKBAWuUZUcFaC5x8plFSueVVLwXd5jr 3+l601g4cvlz4rSCS5+IpT95zQF1vZHrZa9szt/faPBmdTskE7Kilh87ZiJN/aTCCJSZ VHTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=YWr++Z0X0BU6s4L8M0x2MzWud341/6rz/XYDpZbS7vU=; fh=fDSziiI8ClJcApZkUVVpS1fa3szRN1HbcHHuy11mF0U=; b=LCgmzAFXOuHGzRMc5DbqIhDfPhKvuYg8Zzw4PD1o7GZqU6EWNYptBDw02NnnTLXBui L8kY/vjKWXWBdGnEc1Vpzn5lwHNej+hXdnRf58sJxDRaxCJFd5dl2yetJC/NVIG3Apy/ FbnX2Jnis5yrDMj2+wzo9ROsoTqR/dExACesjP9E8MLD+9XRq7H+5tw3L5w49ZkLn3F9 k81O+3G29DW6JjyFnM/XiwKy395AMQIUfrtMELSr6vPjL5qrEE+zxWh9n3KBJMpcVTQF TyHeTaXdGoYl0NCYlRLlm1wKGTMMFkcWWd/jTIHUOxasJJXgETs/+vT2fgULjcVNOFBi 3qLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aculab.com dmarc=pass fromdomain=aculab.com); spf=pass (google.com: domain of linux-kernel+bounces-60795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60795-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com X-Forwarded-Encrypted: i=2; AJvYcCVFfSPb/jmOBhS3VUlbmE03WIBCbNjodZmdt78iawsDMIx56RtkkThH/QzUu3WWyOwWT1Xmfy2W5WU2GXvjyazCNKdgpl7Sq+2aan7WSw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d8-20020a05621421c800b0068ce329b12bsi3983687qvh.408.2024.02.11.05.57.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 05:57:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aculab.com dmarc=pass fromdomain=aculab.com); spf=pass (google.com: domain of linux-kernel+bounces-60795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60795-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 59DA61C21AE1 for ; Sun, 11 Feb 2024 13:57:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD22D5B5BE; Sun, 11 Feb 2024 13:57:39 +0000 (UTC) Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 887395B5AC for ; Sun, 11 Feb 2024 13:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.58.86.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707659859; cv=none; b=dnIxG4BEEwyxrTXRCv7GqZflaW6PGjWUAJXkbagCQNABS2fvWJuBog2g16ALmLjywGr2+bi7Bb62jU0bY3y5vI/qwc8rb4/99s/DZXVNP8L4lGKEI4dLHey9EG5a4Y5eh9zR9LwiVR9UK43G/145hxNU6LNT9jF4dZkoQzivGsA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707659859; c=relaxed/simple; bh=WWvIqMIjphjCfTvYnHbPsiEseK6ecWXtq45WGP3iziI=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: MIME-Version:Content-Type; b=pZtkyiNtY/wWTdTcKtvD8Mbb6e4MgWYgyyPX0bPBQrOcx7BkyItuau7LcGHrkr+MytFRGkvVTYecNAc++iqArl2OJuswH/zJ5BrgQYqkVYwrix4rGO+pF7/plqoZbSQFaoiLLwKGxMBpXHsexrIlS3iW8vQzj/xf3W8yRRretUA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM; spf=pass smtp.mailfrom=aculab.com; arc=none smtp.client-ip=185.58.86.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aculab.com 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-401-aNO8RYdFPpWbb_CKU1AkFQ-1; Sun, 11 Feb 2024 13:57:26 +0000 X-MC-Unique: aNO8RYdFPpWbb_CKU1AkFQ-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; Sun, 11 Feb 2024 13:57:02 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Sun, 11 Feb 2024 13:57:02 +0000 From: David Laight To: 'Guenter Roeck' , Helge Deller CC: "James E . J . Bottomley" , "linux-parisc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Charlie Jenkins" , Palmer Dabbelt Subject: RE: [PATCH] parisc: Fix csum_ipv6_magic on 32-bit systems Thread-Topic: [PATCH] parisc: Fix csum_ipv6_magic on 32-bit systems Thread-Index: AQHaXFWRp9eVLmaVBEGREYhx6VwfXbEFKwHA Date: Sun, 11 Feb 2024 13:57:01 +0000 Message-ID: References: <20240210191556.3761064-1-linux@roeck-us.net> In-Reply-To: <20240210191556.3761064-1-linux@roeck-us.net> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: quoted-printable From: Guenter Roeck > Sent: 10 February 2024 19:16 >=20 > Calculating the IPv6 checksum on 32-bit systems missed overflows when > adding the proto+len fields into the checksum. This results in the > following unit test failure. >=20 > # test_csum_ipv6_magic: ASSERTION FAILED at lib/checksum_kunit.c:506 > Expected ( u64)csum_result =3D=3D ( u64)expected, but > ( u64)csum_result =3D=3D 46722 (0xb682) > ( u64)expected =3D=3D 46721 (0xb681) > not ok 5 test_csum_ipv6_magic >=20 > This is probably rarely seen in the real world because proto+len are > usually small values which will rarely result in overflows when calculati= ng > the checksum. However, the unit test code uses large values for the lengt= h > field, causing the test to fail. Isn't length limited by the protocol encoding? So this is really a bug in the unit tests for using a length that it too large for the function? =09David >=20 > Fix the problem by adding the missing carry into the final checksum. >=20 > Cc: Charlie Jenkins > Cc: Palmer Dabbelt > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Guenter Roeck > --- > arch/parisc/include/asm/checksum.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/parisc/include/asm/checksum.h b/arch/parisc/include/asm= /checksum.h > index f705e5dd1074..e619e67440db 100644 > --- a/arch/parisc/include/asm/checksum.h > +++ b/arch/parisc/include/asm/checksum.h > @@ -163,7 +163,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struc= t in6_addr *saddr, > "=09ldw,ma=09=094(%2), %7\n"=09/* 4th daddr */ > "=09addc=09=09%6, %0, %0\n" > "=09addc=09=09%7, %0, %0\n" > -"=09addc=09=09%3, %0, %0\n"=09/* fold in proto+len, catch carry */ > +"=09addc=09=09%3, %0, %0\n"=09/* fold in proto+len */ > +"=09addc=09=090, %0, %0\n"=09/* add carry */ >=20 > #endif > =09: "=3Dr" (sum), "=3Dr" (saddr), "=3Dr" (daddr), "=3Dr" (len), > -- > 2.39.2 >=20 - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)