Re: IPSec kernel oops on ppc64

2006-08-31 Thread Joy Latten
It works! I applied the patch to 
linux-2.6.17 + patch-2.6.17-rc1
and tried icmp, tcp and udp as well as sftp with 
ipsec and they all worked. 

Thanks

Regards,
Joy

Herbert Xu writes:

 Interesting.  We were previously off by 28 bytes, now we're off by 8 :)

You missed a couple of 'beqlr' instructions (branch if equal to LR).
I'd be interested to know if it still fails with the patch below.

Thanks,
Paul.

diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index fd66acf..7173ba9 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -11,6 +11,7 @@ #include asm/ppc_asm.h
 
   .align  7
 _GLOBAL(memcpy)
+  std r3,48(r1)   /* save destination pointer for return value */
   mtcrf   0x01,r5
   cmpldi  cr1,r5,16
   neg r6,r3   # LS 3 bits = # bytes to 8-byte dest bdry
@@ -38,7 +39,7 @@ _GLOBAL(memcpy)
   stdur9,16(r3)
   bdnz1b
 3:std r8,8(r3)
-  beqlr
+  beq 3f
   addir3,r3,16
   ld  r9,8(r4)
 .Ldo_tail:
@@ -53,7 +54,8 @@ _GLOBAL(memcpy)
 2:bf  cr7*4+3,3f
   rotldi  r9,r9,8
   stb r9,0(r3)
-3:blr
+3:ld  r3,48(r1)   /* return dest pointer */
+  blr
 
 .Lsrc_unaligned:
   srdir6,r5,3
@@ -115,7 +117,7 @@ _GLOBAL(memcpy)
 5:srd r12,r9,r11
   or  r12,r8,r12
   std r12,24(r3)
-  beqlr
+  beq 4f
   cmpwi   cr1,r5,8
   addir3,r3,32
   sld r9,r9,r10
@@ -167,4 +169,5 @@ _GLOBAL(memcpy)
 3:bf  cr7*4+3,4f
   lbz r0,0(r4)
   stb r0,0(r3)
-4:blr
+4:ld  r3,48(r1)   /* return dest pointer */
+  blr
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-30 Thread Herbert Xu
Hi:

Thanks to some excellent info from Joy, I've trakced the problem down to
a broken implementation of memmove on ppc64, which in turn is due to a
broken memcpy.

Both memmove and memcpy need to return the destination pointer as per
the C standard.  The ppc64 version of memcpy returns a pointer to the
last byte copied instead.  Since memmove degenerates into memcpy in
some cases, this makes it broken as well.

Something like the following patch should fix the problem.  Be warned
that I know absolutely nothing about ppc assembly so don't come back
to me if this patch eats your disk :)

BTW, I spotted a couple of typos in memcpy_64.S/copyuser_64.S where
cmpldi cr1,... became cmpldi r1,  So please fix that up while
you ppc64 guys are at it.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index fd66acf..9e8d9e7 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -11,6 +11,7 @@ #include asm/ppc_asm.h
 
.align  7
 _GLOBAL(memcpy)
+   std r3,-8(r1)
mtcrf   0x01,r5
cmpldi  cr1,r5,16
neg r6,r3   # LS 3 bits = # bytes to 8-byte dest bdry
@@ -53,7 +54,8 @@ _GLOBAL(memcpy)
 2: bf  cr7*4+3,3f
rotldi  r9,r9,8
stb r9,0(r3)
-3: blr
+3: ld  r3,-8(r1)
+   blr
 
 .Lsrc_unaligned:
srdir6,r5,3
@@ -167,4 +169,5 @@ _GLOBAL(memcpy)
 3: bf  cr7*4+3,4f
lbz r0,0(r4)
stb r0,0(r3)
-4: blr
+4: ld  r3,-8(r1)
+   blr
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-30 Thread Paul Mackerras
Joy Latten writes:

 The good news is that the pings worked great!
 So perhaps ESP is working ok with ICMP.
 
 But when I tried to do sftp, I still got the oops.
 I don't think TCP and ESP are working.

You're hitting the BUG_ON(len) at line 611 of net/xfrm/xfrm_algo.c.
Is that the same thing that happened without the patch to memcpy, or
was that a different oops?

Paul.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-30 Thread Paul Mackerras
Herbert Xu writes:

 Interesting.  We were previously off by 28 bytes, now we're off by 8 :)

You missed a couple of 'beqlr' instructions (branch if equal to LR).
I'd be interested to know if it still fails with the patch below.

Thanks,
Paul.

diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index fd66acf..7173ba9 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -11,6 +11,7 @@ #include asm/ppc_asm.h
 
.align  7
 _GLOBAL(memcpy)
+   std r3,48(r1)   /* save destination pointer for return value */
mtcrf   0x01,r5
cmpldi  cr1,r5,16
neg r6,r3   # LS 3 bits = # bytes to 8-byte dest bdry
@@ -38,7 +39,7 @@ _GLOBAL(memcpy)
stdur9,16(r3)
bdnz1b
 3: std r8,8(r3)
-   beqlr
+   beq 3f
addir3,r3,16
ld  r9,8(r4)
 .Ldo_tail:
@@ -53,7 +54,8 @@ _GLOBAL(memcpy)
 2: bf  cr7*4+3,3f
rotldi  r9,r9,8
stb r9,0(r3)
-3: blr
+3: ld  r3,48(r1)   /* return dest pointer */
+   blr
 
 .Lsrc_unaligned:
srdir6,r5,3
@@ -115,7 +117,7 @@ _GLOBAL(memcpy)
 5: srd r12,r9,r11
or  r12,r8,r12
std r12,24(r3)
-   beqlr
+   beq 4f
cmpwi   cr1,r5,8
addir3,r3,32
sld r9,r9,r10
@@ -167,4 +169,5 @@ _GLOBAL(memcpy)
 3: bf  cr7*4+3,4f
lbz r0,0(r4)
stb r0,0(r3)
-4: blr
+4: ld  r3,48(r1)   /* return dest pointer */
+   blr
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-30 Thread Herbert Xu
Hi Paul:

On Thu, Aug 31, 2006 at 01:22:07PM +1000, Paul Mackerras wrote:
 
 You missed a couple of 'beqlr' instructions (branch if equal to LR).
 I'd be interested to know if it still fails with the patch below.

Yes that'd do it.

BTW, did you see the cmpldi r1,... stuff in the code?  That's a typo,
right?

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-30 Thread Paul Mackerras
Herbert Xu writes:

 BTW, did you see the cmpldi r1,... stuff in the code?  That's a typo,
 right?

Yes it is a typo, but fixing it is lower priority since both r1 and
cr1 equal 1.

Paul.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-29 Thread Joy Latten
 I can try patch-2.6.18-rc1, etc... to see which one it stops
 working on to narrow it down.

If you could do this in the meanwhile, it would help us out
a lot.

It stops working in patch-2.6.18-rc1. 

Regards,
Joy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-28 Thread Joy Latten
Joy Latten [EMAIL PROTECTED] wrote:
 I installed 2.6.17 + patch-2.6.18-rc4 + 2.6.18-rc4-mm2
 onto two pSeries power 5 (ppc64 lpars) machines. I configured
 IPSec using the configuration listed below. 

Could you try straight 2.6.17? If that crashes too, then at least we
can be sure that it isn't something new.

A straight 2.6.17 kernel does not crash and my pings work.
A 2.6.17 + patch-2.6.18-rc4 does crash and my pings do not work.
The above tests were done on a ppc64. 
I can try patch-2.6.18-rc1, etc... to see which one it stops
working on to narrow it down.

Regards,
Joy

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-28 Thread David Miller
From: Joy Latten [EMAIL PROTECTED]
Date: Mon, 28 Aug 2006 17:25:15 -0500

 I can try patch-2.6.18-rc1, etc... to see which one it stops
 working on to narrow it down.

If you could do this in the meanwhile, it would help us out
a lot.

Thanks.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-28 Thread Herbert Xu
On Mon, Aug 28, 2006 at 05:25:15PM -0500, Joy Latten wrote:
 
 A straight 2.6.17 kernel does not crash and my pings work.
 A 2.6.17 + patch-2.6.18-rc4 does crash and my pings do not work.
 The above tests were done on a ppc64. 

Thanks for that info.  This does sound like a bug.

Could you please generate a dump of the stack/register contents and
a disassembly of the code around the crash?

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-26 Thread Herbert Xu
Joy Latten [EMAIL PROTECTED] wrote:
 I installed 2.6.17 + patch-2.6.18-rc4 + 2.6.18-rc4-mm2
 onto two pSeries power 5 (ppc64 lpars) machines. I configured
 IPSec using the configuration listed below. 

Could you try straight 2.6.17? If that crashes too, then at least we
can be sure that it isn't something new.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IPSec kernel oops on ppc64

2006-08-25 Thread Joy Latten
I installed 2.6.17 + patch-2.6.18-rc4 + 2.6.18-rc4-mm2
onto two pSeries power 5 (ppc64 lpars) machines. I configured
IPSec using the configuration listed below. 

A ping from one machine to the other, hangs. 
No packets leave the machine issuing the ping.
When I tried sftp, I received following oops.

Has anyone else had problems with IPSec on pSeries?

[EMAIL PROTECTED] jml]# sftp hvracer1
Connecting to hvracer1...
kernel BUG in skb_to_sgvec at net/xfrm/xfrm_algo.c:620!
cpu 0x0: Vector: 700 (Program Check) at [c000466eb240]
pc: c035f2f4: .skb_to_sgvec+0x288/0x2ec
lr: d09605e0: .esp_output+0x340/0x494 [esp4]
sp: c000466eb4c0
   msr: 80029032
  current = 0xc00045a69910
  paca= 0xc0484400
pid   = 2213, comm = ssh
kernel BUG in skb_to_sgvec at net/xfrm/xfrm_algo.c:620!
enter ? for help
0:mon t
[c000466eb590] d09605e0 .esp_output+0x340/0x494 [esp4]
[c000466eb680] c0357bd4 .xfrm4_output_finish2+0x2b8/0x3d0
[c000466eb720] c0357ea0 .xfrm4_output+0x74/0x88
[c000466eb7a0] c031b188 .ip_queue_xmit+0x4a8/0x540
[c000466eb8a0] c032e9b8 .tcp_transmit_skb+0x820/0x890
[c000466eb960] c0331b74 .tcp_connect+0x308/0x3b0
[c000466eba00] c03361d0 .tcp_v4_connect+0x52c/0x6c0
[c000466ebb80] c0344664 .inet_stream_connect+0x10c/0x358
[c000466ebc60] c02dba14 .sys_connect+0xd8/0x120
[c000466ebd90] c02fe420 .compat_sys_socketcall+0xdc/0x214
[c000466ebe30] c000871c syscall_exit+0x0/0x40
--- Exception: c00 (System Call) at 07a9f8fc
SP (fc63f230) is in userspace



Configured IPSec as follows:

add x.x.x.55 x.x.x.206 esp 35590
-m transport
-E 3des-cbc 06183223c23a21e8b36c566b
-A hmac-md5 TAHITEST89ABCDEF;

add x.x.x.206 x.x.x.55 esp 12360
-m transport
-E 3des-cbc 06183223c23a21e8b36c566b
-A hmac-md5 TAHITEST89ABCDEF;

spdadd x.x.x.55 x.x.x.206 any -P in ipsec
esp/transport//require;

spdadd x.x.x.206 x.x.x.55 any -P out ipsec
esp/transport//require;

Same config on both machines, except for  spdadd entry. The in and out
are swapped on the other machine.


Regards,
Joy Latten
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-25 Thread James Morris
On Fri, 25 Aug 2006, Joy Latten wrote:

 I installed 2.6.17 + patch-2.6.18-rc4 + 2.6.18-rc4-mm2
 onto two pSeries power 5 (ppc64 lpars) machines. I configured
 IPSec using the configuration listed below. 

Confirming that this does not crash on i686 or x86_64.



- james
-- 
James Morris
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPSec kernel oops on ppc64

2006-08-25 Thread David Miller
From: James Morris [EMAIL PROTECTED]
Date: Fri, 25 Aug 2006 19:15:57 -0400 (EDT)

 On Fri, 25 Aug 2006, Joy Latten wrote:
 
  I installed 2.6.17 + patch-2.6.18-rc4 + 2.6.18-rc4-mm2
  onto two pSeries power 5 (ppc64 lpars) machines. I configured
  IPSec using the configuration listed below. 
 
 Confirming that this does not crash on i686 or x86_64.

Probably best to start with retesting with 2.6.18-rc4, and
if that crashes too it is time to think seriously about
a miscompile on ppc64.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html