UPSTREAM: arm64: don't call C code with el0's fp register
authorJames Morse <james.morse@arm.com>
Thu, 10 Dec 2015 10:22:41 +0000 (10:22 +0000)
committerJeffrey Vander Stoep <jeffv@google.com>
Fri, 16 Sep 2016 21:33:36 +0000 (21:33 +0000)
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>
Bug: 30369029
Patchset: per-cpu-irq-stack

(cherry picked from commit 49003a8d6b35e128ef5e51433e60e783a46fbe5f)
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Change-Id: Ifae7003018e4088d5de038cef25fa210211a75b6

arch/arm64/kernel/entry.S

index e394f8c9595a493f00c083f1d0733ad1fdca5a27..2284c296e3f71a11286d0969e067285977bc42f6 100644 (file)
@@ -93,6 +93,8 @@
        and     tsk, tsk, #~(THREAD_SIZE - 1)   // Ensure MDSCR_EL1.SS is clear,
        ldr     x19, [tsk, #TI_FLAGS]           // since we can unmask debug
        disable_step_tsk x19, x20               // exceptions when scheduling.
+
+       mov     x29, xzr                        // fp pointed to user-space
        .else
        add     x21, sp, #S_FRAME_SIZE
        .endif