Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: don't call C code with el0's fp register

On entry from el0, we save all the registers on the kernel stack, and
restore them before returning. x29 remains unchanged when we call out
to C code, which will store x29 as the frame-pointer on the stack.

Instead, write 0 into x29 after entry from el0, to avoid any risk of
tracing into user space.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

authored by

James Morse and committed by
Will Deacon
49003a8d 1ffe199b

+2
+2
arch/arm64/kernel/entry.S
··· 93 93 and tsk, tsk, #~(THREAD_SIZE - 1) // Ensure MDSCR_EL1.SS is clear, 94 94 ldr x19, [tsk, #TI_FLAGS] // since we can unmask debug 95 95 disable_step_tsk x19, x20 // exceptions when scheduling. 96 + 97 + mov x29, xzr // fp pointed to user-space 96 98 .else 97 99 add x21, sp, #S_FRAME_SIZE 98 100 .endif