* [PATCH] powerpc: fix csum_ipv6_magic() on little endian platforms
@ 2018-09-10 6:09 Christophe Leroy
2018-09-10 14:28 ` Xin Long
2018-09-21 11:59 ` Michael Ellerman
0 siblings, 2 replies; 4+ messages in thread
From: Christophe Leroy @ 2018-09-10 6:09 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Jianlin Shi, Xin Long
Cc: linux-kernel, linuxppc-dev, stable
On little endian platforms, csum_ipv6_magic() keeps len and proto in
CPU byte order. This generates a bad results leading to ICMPv6 packets
from other hosts being dropped by powerpc64le platforms.
In order to fix this, len and proto should be converted to network
byte order ie bigendian byte order. However checksumming 0x12345678
and 0x56341278 provide the exact same result so it is enough to
rotate the sum of len and proto by 1 byte.
PPC32 only support bigendian so the fix is needed for PPC64 only
Fixes: e9c4943a107b ("powerpc: Implement csum_ipv6_magic in assembly")
Reported-by: Jianlin Shi <jishi@redhat.com>
Reported-by: Xin Long <lucien.xin@gmail.com>
Cc: <stable@vger.kernel.org> # 4.18+
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
arch/powerpc/lib/checksum_64.S | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
index 886ed94b9c13..2a68c43e13f5 100644
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -443,6 +443,9 @@ _GLOBAL(csum_ipv6_magic)
addc r0, r8, r9
ld r10, 0(r4)
ld r11, 8(r4)
+#ifndef CONFIG_CPU_BIG_ENDIAN
+ rotldi r5, r5, 8
+#endif
adde r0, r0, r10
add r5, r5, r7
adde r0, r0, r11
--
2.13.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc: fix csum_ipv6_magic() on little endian platforms
2018-09-10 6:09 [PATCH] powerpc: fix csum_ipv6_magic() on little endian platforms Christophe Leroy
@ 2018-09-10 14:28 ` Xin Long
2018-09-17 12:27 ` Christophe LEROY
2018-09-21 11:59 ` Michael Ellerman
1 sibling, 1 reply; 4+ messages in thread
From: Xin Long @ 2018-09-10 14:28 UTC (permalink / raw)
To: Christophe Leroy
Cc: benh, paulus, Michael Ellerman, jishi, LKML, linuxppc-dev, stable
On Mon, Sep 10, 2018 at 2:09 PM Christophe Leroy
<christophe.leroy@c-s.fr> wrote:
>
> On little endian platforms, csum_ipv6_magic() keeps len and proto in
> CPU byte order. This generates a bad results leading to ICMPv6 packets
> from other hosts being dropped by powerpc64le platforms.
>
> In order to fix this, len and proto should be converted to network
> byte order ie bigendian byte order. However checksumming 0x12345678
> and 0x56341278 provide the exact same result so it is enough to
> rotate the sum of len and proto by 1 byte.
>
> PPC32 only support bigendian so the fix is needed for PPC64 only
>
> Fixes: e9c4943a107b ("powerpc: Implement csum_ipv6_magic in assembly")
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Reported-by: Xin Long <lucien.xin@gmail.com>
> Cc: <stable@vger.kernel.org> # 4.18+
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
> arch/powerpc/lib/checksum_64.S | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
> index 886ed94b9c13..2a68c43e13f5 100644
> --- a/arch/powerpc/lib/checksum_64.S
> +++ b/arch/powerpc/lib/checksum_64.S
> @@ -443,6 +443,9 @@ _GLOBAL(csum_ipv6_magic)
> addc r0, r8, r9
> ld r10, 0(r4)
> ld r11, 8(r4)
> +#ifndef CONFIG_CPU_BIG_ENDIAN
> + rotldi r5, r5, 8
> +#endif
> adde r0, r0, r10
> add r5, r5, r7
> adde r0, r0, r11
> --
> 2.13.3
>
Tested-by: Xin Long <lucien.xin@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc: fix csum_ipv6_magic() on little endian platforms
2018-09-10 14:28 ` Xin Long
@ 2018-09-17 12:27 ` Christophe LEROY
0 siblings, 0 replies; 4+ messages in thread
From: Christophe LEROY @ 2018-09-17 12:27 UTC (permalink / raw)
To: Michael Ellerman
Cc: Xin Long, benh, paulus, jishi, LKML, linuxppc-dev, stable,
netdev, David Miller
Hi Michael,
Le 10/09/2018 à 16:28, Xin Long a écrit :
> On Mon, Sep 10, 2018 at 2:09 PM Christophe Leroy
> <christophe.leroy@c-s.fr> wrote:
>>
>> On little endian platforms, csum_ipv6_magic() keeps len and proto in
>> CPU byte order. This generates a bad results leading to ICMPv6 packets
>> from other hosts being dropped by powerpc64le platforms.
>>
>> In order to fix this, len and proto should be converted to network
>> byte order ie bigendian byte order. However checksumming 0x12345678
>> and 0x56341278 provide the exact same result so it is enough to
>> rotate the sum of len and proto by 1 byte.
>>
>> PPC32 only support bigendian so the fix is needed for PPC64 only
>>
>> Fixes: e9c4943a107b ("powerpc: Implement csum_ipv6_magic in assembly")
>> Reported-by: Jianlin Shi <jishi@redhat.com>
>> Reported-by: Xin Long <lucien.xin@gmail.com>
>> Cc: <stable@vger.kernel.org> # 4.18+
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>> ---
>> arch/powerpc/lib/checksum_64.S | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
>> index 886ed94b9c13..2a68c43e13f5 100644
>> --- a/arch/powerpc/lib/checksum_64.S
>> +++ b/arch/powerpc/lib/checksum_64.S
>> @@ -443,6 +443,9 @@ _GLOBAL(csum_ipv6_magic)
>> addc r0, r8, r9
>> ld r10, 0(r4)
>> ld r11, 8(r4)
>> +#ifndef CONFIG_CPU_BIG_ENDIAN
>> + rotldi r5, r5, 8
>> +#endif
>> adde r0, r0, r10
>> add r5, r5, r7
>> adde r0, r0, r11
>> --
>> 2.13.3
>>
> Tested-by: Xin Long <lucien.xin@gmail.com>
>
Could you take this fix for 4.19 ?
Unless someone takes it through the netdev tree ?
Thanks
Christophe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: powerpc: fix csum_ipv6_magic() on little endian platforms
2018-09-10 6:09 [PATCH] powerpc: fix csum_ipv6_magic() on little endian platforms Christophe Leroy
2018-09-10 14:28 ` Xin Long
@ 2018-09-21 11:59 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2018-09-21 11:59 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
Jianlin Shi, Xin Long
Cc: linuxppc-dev, linux-kernel, stable
On Mon, 2018-09-10 at 06:09:04 UTC, Christophe Leroy wrote:
> On little endian platforms, csum_ipv6_magic() keeps len and proto in
> CPU byte order. This generates a bad results leading to ICMPv6 packets
> from other hosts being dropped by powerpc64le platforms.
>
> In order to fix this, len and proto should be converted to network
> byte order ie bigendian byte order. However checksumming 0x12345678
> and 0x56341278 provide the exact same result so it is enough to
> rotate the sum of len and proto by 1 byte.
>
> PPC32 only support bigendian so the fix is needed for PPC64 only
>
> Fixes: e9c4943a107b ("powerpc: Implement csum_ipv6_magic in assembly")
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Reported-by: Xin Long <lucien.xin@gmail.com>
> Cc: <stable@vger.kernel.org> # 4.18+
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Tested-by: Xin Long <lucien.xin@gmail.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/85682a7e3b9c664995ad477520f917
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-21 11:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10 6:09 [PATCH] powerpc: fix csum_ipv6_magic() on little endian platforms Christophe Leroy
2018-09-10 14:28 ` Xin Long
2018-09-17 12:27 ` Christophe LEROY
2018-09-21 11:59 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.