linux-stable/arch/parisc
Guenter Roeck ceffd026f8 parisc: Strip upper 32 bit of sum in csum_ipv6_magic for 64-bit builds
[ Upstream commit 0568b6f0d8 ]

IPv6 checksum tests with unaligned addresses on 64-bit builds result
in unexpected failures.

Expected expected == csum_result, but
    expected == 46591 (0xb5ff)
    csum_result == 46381 (0xb52d)
with alignment offset 1

Oddly enough, the problem disappeared after adding test code into
the beginning of csum_ipv6_magic().

As it turns out, the 'sum' parameter of csum_ipv6_magic() is declared as
__wsum, which is a 32-bit variable. However, it is treated as 64-bit
variable in the 64-bit assembler code. Tests showed that the upper 32 bit
of the register used to pass the variable are _not_ cleared when entering
the function. This can result in checksum calculation errors.

Clearing the upper 32 bit of 'sum' as first operation in the assembler
code fixes the problem.

Acked-by: Helge Deller <deller@gmx.de>
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:19:28 +02:00
..
boot Kbuild updates for v5.17 2022-01-19 11:15:19 +02:00
configs parisc: Update 32- and 64-bit defconfigs 2022-05-08 20:01:11 +02:00
include parisc: Strip upper 32 bit of sum in csum_ipv6_magic for 64-bit builds 2024-04-03 15:19:28 +02:00
kernel parisc/unaligned: Rewrite 64-bit inline assembly of emulate_ldd() 2024-04-03 15:19:27 +02:00
lib parisc: Drop homebrewn io[read|write]64_[lo_hi|hi_lo] 2022-09-23 21:52:27 +02:00
math-emu parisc: align '*' in comment in math-emu code 2022-06-26 00:19:27 +02:00
mm parisc: Fix random data corruption from exception handler 2024-02-23 09:12:50 +01:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig parisc: Fix random data corruption from exception handler 2024-02-23 09:12:50 +01:00
Kconfig.debug tracing: Refactor TRACE_IRQFLAGS_SUPPORT in Kconfig 2021-08-16 11:37:21 -04:00
Makefile kbuild: remove head-y syntax 2022-10-02 18:06:03 +09:00
defpalo.conf
install.sh kbuild: factor out the common installation code into scripts/install.sh 2022-05-11 21:45:53 +09:00