public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
@ 2009-09-26 19:27 Samuel Thibault
  2009-09-30 22:40 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Thibault @ 2009-09-26 19:27 UTC (permalink / raw)
  To: linux-kernel

Just like ip_fast_csum, the assembly snippet in csum_ipv6_magic needs a
memory clobber, as it is only passed the address of the buffer, not a
memory reference to the buffer itself.

Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: stable@kernel.org

diff --git a/arch/x86/include/asm/checksum_32.h b/arch/x86/include/asm/checksum_32.h
index 7c5ef8b..46fc474 100644
--- a/arch/x86/include/asm/checksum_32.h
+++ b/arch/x86/include/asm/checksum_32.h
@@ -161,7 +161,8 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
 	    "adcl $0, %0	;\n"
 	    : "=&r" (sum)
 	    : "r" (saddr), "r" (daddr),
-	      "r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
+	      "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
+	    : "memory");
 
 	return csum_fold(sum);
 }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
  2009-09-26 19:27 [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber Samuel Thibault
@ 2009-09-30 22:40 ` Andrew Morton
  2009-09-30 22:45   ` H. Peter Anvin
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2009-09-30 22:40 UTC (permalink / raw)
  To: Samuel Thibault
  Cc: linux-kernel, Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	David S. Miller, Andi Kleen

On Sat, 26 Sep 2009 21:27:48 +0200
Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:

> Just like ip_fast_csum, the assembly snippet in csum_ipv6_magic needs a
> memory clobber, as it is only passed the address of the buffer, not a
> memory reference to the buffer itself.
> 
> Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
> Cc: stable@kernel.org
> 
> diff --git a/arch/x86/include/asm/checksum_32.h b/arch/x86/include/asm/checksum_32.h
> index 7c5ef8b..46fc474 100644
> --- a/arch/x86/include/asm/checksum_32.h
> +++ b/arch/x86/include/asm/checksum_32.h
> @@ -161,7 +161,8 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
>  	    "adcl $0, %0	;\n"
>  	    : "=&r" (sum)
>  	    : "r" (saddr), "r" (daddr),
> -	      "r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
> +	      "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
> +	    : "memory");
>  
>  	return csum_fold(sum);
>  }

You describe it as "trivial" and also cc stable@kernel.org.  These things
are contradictory!

Maybe backporting it is a good idea from a sleep-soundly-at-night POV. 
I don't know..


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
  2009-09-30 22:40 ` Andrew Morton
@ 2009-09-30 22:45   ` H. Peter Anvin
  2009-09-30 23:01     ` Samuel Thibault
  0 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2009-09-30 22:45 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Samuel Thibault, linux-kernel, Ingo Molnar, Thomas Gleixner,
	David S. Miller, Andi Kleen

On 09/30/2009 03:40 PM, Andrew Morton wrote:
> 
> You describe it as "trivial" and also cc stable@kernel.org.  These things
> are contradictory!
> 
> Maybe backporting it is a good idea from a sleep-soundly-at-night POV. 
> I don't know..
> 

/me suspects it was supposed to mean "trivially correct", which isn't
really what "trivial" means.  This is a potentially serious bug and
should be treated as such.

	-hpa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
  2009-09-30 22:45   ` H. Peter Anvin
@ 2009-09-30 23:01     ` Samuel Thibault
  2009-09-30 23:19       ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Thibault @ 2009-09-30 23:01 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Andrew Morton, linux-kernel, Ingo Molnar, Thomas Gleixner,
	David S. Miller, Andi Kleen

H. Peter Anvin, le Wed 30 Sep 2009 15:45:15 -0700, a écrit :
> On 09/30/2009 03:40 PM, Andrew Morton wrote:
> > You describe it as "trivial" and also cc stable@kernel.org.  These things
> > are contradictory!
> > 
> > Maybe backporting it is a good idea from a sleep-soundly-at-night POV. 
> > I don't know..
> 
> /me suspects it was supposed to mean "trivially correct",

Yes.

> which isn't really what "trivial" means.

Ah.

> This is a potentially serious bug and should be treated as such.

Yes.  Actually it hit Hurd's pfinetv4 when we tried to compile it with
gcc-4.3 (bogus checksums).

Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
  2009-09-30 23:01     ` Samuel Thibault
@ 2009-09-30 23:19       ` Andrew Morton
  2009-09-30 23:22         ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2009-09-30 23:19 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: hpa, linux-kernel, mingo, tglx, davem, andi, netdev

On Thu, 1 Oct 2009 01:01:38 +0200
Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:

> Actually it hit Hurd's pfinetv4 when we tried to compile it with
> gcc-4.3 (bogus checksums).

That's important information!  I updated the changelog and added the
Cc:stable, thanks.


Full patch for netdev benefit:


From: Samuel Thibault <samuel.thibault@ens-lyon.org>

Just like ip_fast_csum, the assembly snippet in csum_ipv6_magic needs a
memory clobber, as it is only passed the address of the buffer, not a
memory reference to the buffer itself.

This caused failures in Hurd's pfinetv4 when we tried to compile it with
gcc-4.3 (bogus checksums).

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 arch/x86/include/asm/checksum_32.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN arch/x86/include/asm/checksum_32.h~x86-fix-csum_ipv6_magic-asm-memory-clobber arch/x86/include/asm/checksum_32.h
--- a/arch/x86/include/asm/checksum_32.h~x86-fix-csum_ipv6_magic-asm-memory-clobber
+++ a/arch/x86/include/asm/checksum_32.h
@@ -161,7 +161,8 @@ static inline __sum16 csum_ipv6_magic(co
 	    "adcl $0, %0	;\n"
 	    : "=&r" (sum)
 	    : "r" (saddr), "r" (daddr),
-	      "r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
+	      "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
+	    : "memory");
 
 	return csum_fold(sum);
 }
_


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
  2009-09-30 23:19       ` Andrew Morton
@ 2009-09-30 23:22         ` David Miller
  2009-09-30 23:45           ` H. Peter Anvin
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2009-09-30 23:22 UTC (permalink / raw)
  To: akpm; +Cc: samuel.thibault, hpa, linux-kernel, mingo, tglx, andi, netdev

From: Andrew Morton <akpm@linux-foundation.org>
Date: Wed, 30 Sep 2009 16:19:39 -0700

> From: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 
> Just like ip_fast_csum, the assembly snippet in csum_ipv6_magic needs a
> memory clobber, as it is only passed the address of the buffer, not a
> memory reference to the buffer itself.
> 
> This caused failures in Hurd's pfinetv4 when we tried to compile it with
> gcc-4.3 (bogus checksums).
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

I'm happy to see this go in via the x86 tree, and thus:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber
  2009-09-30 23:22         ` David Miller
@ 2009-09-30 23:45           ` H. Peter Anvin
  0 siblings, 0 replies; 7+ messages in thread
From: H. Peter Anvin @ 2009-09-30 23:45 UTC (permalink / raw)
  To: David Miller
  Cc: akpm, samuel.thibault, linux-kernel, mingo, tglx, andi, netdev

On 09/30/2009 04:22 PM, David Miller wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
> Date: Wed, 30 Sep 2009 16:19:39 -0700
> 
>> From: Samuel Thibault <samuel.thibault@ens-lyon.org>
>>
>> Just like ip_fast_csum, the assembly snippet in csum_ipv6_magic needs a
>> memory clobber, as it is only passed the address of the buffer, not a
>> memory reference to the buffer itself.
>>
>> This caused failures in Hurd's pfinetv4 when we tried to compile it with
>> gcc-4.3 (bogus checksums).
>>
>> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
>> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> 
> I'm happy to see this go in via the x86 tree, and thus:
> 
> Acked-by: David S. Miller <davem@davemloft.net>

I'll put it in x86/urgent tonight or early tomorrow morning (just about
to leave for the airport.)

	-hpa


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-09-30 23:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-26 19:27 [PATCH,TRIVIAL] Fix csum_ipv6_magic asm memory clobber Samuel Thibault
2009-09-30 22:40 ` Andrew Morton
2009-09-30 22:45   ` H. Peter Anvin
2009-09-30 23:01     ` Samuel Thibault
2009-09-30 23:19       ` Andrew Morton
2009-09-30 23:22         ` David Miller
2009-09-30 23:45           ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox