mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: David Laight <David.Laight@ACULAB.COM>, Helge Deller <deller@gmx.de>
Cc: "James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
	"linux-parisc@vger.kernel.org" <linux-parisc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Charlie Jenkins <charlie@rivosinc.com>,
	Palmer Dabbelt <palmer@rivosinc.com>
Subject: Re: [PATCH] parisc: Fix csum_ipv6_magic on 32-bit systems
Date: Sun, 11 Feb 2024 06:09:14 -0800	[thread overview]
Message-ID: <7aa3e2ad-ce91-4b5c-a253-e5fd3c2645b0@roeck-us.net> (raw)
In-Reply-To: <dae9f9c428a242368d47ba29561e9455@AcuMS.aculab.com>

On 2/11/24 05:57, David Laight wrote:
> From: Guenter Roeck
>> Sent: 10 February 2024 19:16
>>
>> 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.
>>
>>      # test_csum_ipv6_magic: ASSERTION FAILED at lib/checksum_kunit.c:506
>>      Expected ( u64)csum_result == ( u64)expected, but
>>          ( u64)csum_result == 46722 (0xb682)
>>          ( u64)expected == 46721 (0xb681)
>>      not ok 5 test_csum_ipv6_magic
>>
>> This is probably rarely seen in the real world because proto+len are
>> usually small values which will rarely result in overflows when calculating
>> the checksum. However, the unit test code uses large values for the length
>> 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?
> 

Arguable. While the length value passed to the function is not a valid
packet length, it exposes a weakness in the implementation of
csum_ipv6_magic() - after all, folding proto+len into the checksum _may_
overflow even for small(er) values of proto and length. It is just much
less likely to happen if the length is limited to 16 bit.

Guenter


  reply	other threads:[~2024-02-11 14:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-10 19:15 Guenter Roeck
2024-02-11 13:57 ` David Laight
2024-02-11 14:09   ` Guenter Roeck [this message]
2024-02-14  1:15 ` Charlie Jenkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7aa3e2ad-ce91-4b5c-a253-e5fd3c2645b0@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=David.Laight@ACULAB.COM \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=charlie@rivosinc.com \
    --cc=deller@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=palmer@rivosinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®