Skip to content

Commit

Permalink
powerpc/memcpy: Fix stack corruption for smaller sizes
Browse files Browse the repository at this point in the history
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 <aneesh.kumar@linux.ibm.com>
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190903214359.23887-1-santosh@fossix.org
  • Loading branch information
Santosh Sivaraj authored and Michael Ellerman committed Sep 11, 2019
1 parent aa497d4 commit 20055a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/lib/memcpy_mcsafe_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ err1; stw r0,0(r3)

3: sub r5,r5,r6
cmpldi r5,128
blt 5f

mflr r0
stdu r1,-STACKFRAMESIZE(r1)
Expand All @@ -99,6 +98,7 @@ err1; stw r0,0(r3)
std r22,STK_REG(R22)(r1)
std r0,STACKFRAMESIZE+16(r1)

blt 5f
srdi r6,r5,7
mtctr r6

Expand Down

0 comments on commit 20055a8

Please sign in to comment.