lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 2 May 2024 09:21:03 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
Cc: Guenter Roeck <linux@...ck-us.net>, Yoshinori Sato <ysato@...rs.sourceforge.jp>, 
	Rich Felker <dalias@...c.org>, linux-sh@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Revert "sh: Handle calling csum_partial with misaligned data"

On Wed, May 1, 2024 at 10:28 AM John Paul Adrian Glaubitz
<glaubitz@...sik.fu-berlin.de> wrote:
> On Tue, 2024-04-02 at 16:09 +0200, John Paul Adrian Glaubitz wrote:
> > On Tue, 2024-04-02 at 07:06 -0700, Guenter Roeck wrote:
> > > On Mon, Mar 25, 2024 at 07:34:00AM -0700, Guenter Roeck wrote:
> > > > On 3/25/24 00:39, John Paul Adrian Glaubitz wrote:
> > > > > Hi Guenter,
> > > > >
> > > > > On Sun, 2024-03-24 at 16:18 -0700, Guenter Roeck wrote:
> > > > > > This reverts commit cadc4e1a2b4d20d0cc0e81f2c6ba0588775e54e5.
> > > > > >
> > > > > > Commit cadc4e1a2b4d ("sh: Handle calling csum_partial with misaligned
> > > > > > data") causes bad checksum calculations on unaligned data. Reverting
> > > > > > it fixes the problem.
> > > > > >
> > > > > >      # Subtest: checksum
> > > > > >      # module: checksum_kunit
> > > > > >      1..5
> > > > > >      # test_csum_fixed_random_inputs: ASSERTION FAILED at lib/checksum_kunit.c:500
> > > > > >      Expected ( u64)result == ( u64)expec, but
> > > > > >          ( u64)result == 53378 (0xd082)
> > > > > >          ( u64)expec == 33488 (0x82d0)
> > > > > >      # test_csum_fixed_random_inputs: pass:0 fail:1 skip:0 total:1
> > > > > >      not ok 1 test_csum_fixed_random_inputs
> > > > > >      # test_csum_all_carry_inputs: ASSERTION FAILED at lib/checksum_kunit.c:525
> > > > > >      Expected ( u64)result == ( u64)expec, but
> > > > > >          ( u64)result == 65281 (0xff01)
> > > > > >          ( u64)expec == 65280 (0xff00)
> > > > > >      # test_csum_all_carry_inputs: pass:0 fail:1 skip:0 total:1
> > > > > >      not ok 2 test_csum_all_carry_inputs
> > > > > >      # test_csum_no_carry_inputs: ASSERTION FAILED at lib/checksum_kunit.c:573
> > > > > >      Expected ( u64)result == ( u64)expec, but
> > > > > >          ( u64)result == 65535 (0xffff)
> > > > > >          ( u64)expec == 65534 (0xfffe)
> > > > > >      # test_csum_no_carry_inputs: pass:0 fail:1 skip:0 total:1
> > > > > >      not ok 3 test_csum_no_carry_inputs
> > > > > >      # test_ip_fast_csum: pass:1 fail:0 skip:0 total:1
> > > > > >      ok 4 test_ip_fast_csum
> > > > > >      # test_csum_ipv6_magic: pass:1 fail:0 skip:0 total:1
> > > > > >      ok 5 test_csum_ipv6_magic
> > > > > >   # checksum: pass:2 fail:3 skip:0 total:5
> > > > > >   # Totals: pass:2 fail:3 skip:0 total:5
> > > > > > not ok 22 checksum
> > > > >
> > > > > Can you tell me how the tests are run so I can try to verify this on real hardware?
> > > > >
> > > >
> > > > Enabling CONFIG_KUNIT and CHECKSUM_KUNIT and booting with those tests enabled
> > > > should do it.
> > > >
> > >
> > > Did you have time to test this on real hardware ?
> >
> > Not yet. I just returned from Easter holidays and need to get synced with work first.
>
> I might have to skip this for v6.10 as I haven't been able to test this yet.
>
> I agree with the change in general, but I want to make sure I can reproduce
> this on real hardware.

On landisk:

 KTAP version 1
 1..1
     KTAP version 1
     # Subtest: checksum
     # module: checksum_kunit
     1..5
-    # test_csum_fixed_random_inputs: ASSERTION FAILED at
lib/checksum_kunit.c:500
-    Expected ( u64)result == ( u64)expec, but
-        ( u64)result == 53378 (0xd082)
-        ( u64)expec == 33488 (0x82d0)
-    not ok 1 test_csum_fixed_random_inputs
-    # test_csum_all_carry_inputs: ASSERTION FAILED at lib/checksum_kunit.c:525
-    Expected ( u64)result == ( u64)expec, but
-        ( u64)result == 65281 (0xff01)
-        ( u64)expec == 65280 (0xff00)
-    not ok 2 test_csum_all_carry_inputs
-    # test_csum_no_carry_inputs: ASSERTION FAILED at lib/checksum_kunit.c:573
-    Expected ( u64)result == ( u64)expec, but
-        ( u64)result == 65535 (0xffff)
-        ( u64)expec == 65534 (0xfffe)
-    not ok 3 test_csum_no_carry_inputs
+    # test_csum_fixed_random_inputs: Test should be marked slow
(runtime: 9.814991070s)
+    ok 1 test_csum_fixed_random_inputs
+    # test_csum_all_carry_inputs: Test should be marked slow
(runtime: 19.621274580s)
+    ok 2 test_csum_all_carry_inputs
+    # test_csum_no_carry_inputs: Test should be marked slow (runtime:
19.614096540s)
+    ok 3 test_csum_no_carry_inputs
     ok 4 test_ip_fast_csum
     ok 5 test_csum_ipv6_magic
-# checksum: pass:2 fail:3 skip:0 total:5
-# Totals: pass:2 fail:3 skip:0 total:5
-not ok 1 checksum
+# checksum: pass:5 fail:0 skip:0 total:5
+# Totals: pass:5 fail:0 skip:0 total:5
+ok 1 checksum

As we aim for correctness over performance:
Tested-by: Geert Uytterhoeven <geert+renesas@...der.be>

However, given the big impact on performance, it would be great if
someone could find out what's wrong with the optimized version.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68korg

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ