Skip to content

Commit 36b0cb8

Browse files
lyrazhangRussell King
authored andcommitted
ARM: 8731/1: Fix csum_partial_copy_from_user() stack mismatch
An additional 'ip' will be pushed to the stack, for restoring the DACR later, if CONFIG_CPU_SW_DOMAIN_PAN defined. However, the fixup still get the err_ptr by add #8*4 to sp, which results in the fact that the code area pointed by the LR will be overwritten, or the kernel will crash if CONFIG_DEBUG_RODATA is enabled. This patch fixes the stack mismatch. Fixes: a5e090a ("ARM: software-based priviledged-no-access support") Signed-off-by: Lvqiang Huang <[email protected]> Signed-off-by: Chunyan Zhang <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent ae64f9b commit 36b0cb8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm/lib/csumpartialcopyuser.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@
8585
.pushsection .text.fixup,"ax"
8686
.align 4
8787
9001: mov r4, #-EFAULT
88+
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
89+
ldr r5, [sp, #9*4] @ *err_ptr
90+
#else
8891
ldr r5, [sp, #8*4] @ *err_ptr
92+
#endif
8993
str r4, [r5]
9094
ldmia sp, {r1, r2} @ retrieve dst, len
9195
add r2, r2, r1

0 commit comments

Comments
 (0)