Re: [PATCH 1/2] powerpc/memcpy: Fix stack corruption for smaller sizes

2019-09-19 Thread Michael Ellerman
On Tue, 2019-09-03 at 21:43:58 UTC, Santosh Sivaraj wrote:
> For sizes lesser than 128 bytes, the code branches out early without saving
> the stack frame, which when restored later drops frame of the caller.
> 
> Tested-by: Aneesh Kumar K.V 
> Signed-off-by: Santosh Sivaraj 

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/20055a8bfaaa75f2cb9c23ecc8ab12b4abd8dc84

cheers


Re: [PATCH 1/2] powerpc/memcpy: Fix stack corruption for smaller sizes

2019-09-06 Thread Christophe Leroy

Hi,

The subjet is misleading. This isn't powerpc but only powerpc/64, and 
this is not memcpy() but memcpy_mcsafe()


Christophe

Le 03/09/2019 à 23:43, Santosh Sivaraj a écrit :

For sizes lesser than 128 bytes, the code branches out early without saving
the stack frame, which when restored later drops frame of the caller.

Tested-by: Aneesh Kumar K.V 
Signed-off-by: Santosh Sivaraj 
---
  arch/powerpc/lib/memcpy_mcsafe_64.S | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/memcpy_mcsafe_64.S 
b/arch/powerpc/lib/memcpy_mcsafe_64.S
index 949976dc115d..cb882d9a6d8a 100644
--- a/arch/powerpc/lib/memcpy_mcsafe_64.S
+++ b/arch/powerpc/lib/memcpy_mcsafe_64.S
@@ -84,7 +84,6 @@ err1; stw r0,0(r3)
  
  3:	sub	r5,r5,r6

cmpldi  r5,128
-   blt 5f
  
  	mflr	r0

stdur1,-STACKFRAMESIZE(r1)
@@ -99,6 +98,7 @@ err1; stw r0,0(r3)
std r22,STK_REG(R22)(r1)
std r0,STACKFRAMESIZE+16(r1)
  
+	blt	5f

srdir6,r5,7
mtctr   r6
  



[PATCH 1/2] powerpc/memcpy: Fix stack corruption for smaller sizes

2019-09-03 Thread Santosh Sivaraj
For sizes lesser than 128 bytes, the code branches out early without saving
the stack frame, which when restored later drops frame of the caller.

Tested-by: Aneesh Kumar K.V 
Signed-off-by: Santosh Sivaraj 
---
 arch/powerpc/lib/memcpy_mcsafe_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/memcpy_mcsafe_64.S 
b/arch/powerpc/lib/memcpy_mcsafe_64.S
index 949976dc115d..cb882d9a6d8a 100644
--- a/arch/powerpc/lib/memcpy_mcsafe_64.S
+++ b/arch/powerpc/lib/memcpy_mcsafe_64.S
@@ -84,7 +84,6 @@ err1; stw r0,0(r3)
 
 3: sub r5,r5,r6
cmpldi  r5,128
-   blt 5f
 
mflrr0
stdur1,-STACKFRAMESIZE(r1)
@@ -99,6 +98,7 @@ err1; stw r0,0(r3)
std r22,STK_REG(R22)(r1)
std r0,STACKFRAMESIZE+16(r1)
 
+   blt 5f
srdir6,r5,7
mtctr   r6
 
-- 
2.21.0