arm64: ftrace: modify a stack frame in a safe way
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Tue, 15 Dec 2015 08:33:39 +0000 (17:33 +0900)
committerAlex Shi <alex.shi@linaro.org>
Wed, 11 May 2016 09:01:05 +0000 (17:01 +0800)
commit76f2d0af233200abc487122d0002f3c14d796676
tree9a1d9e3e72f9cac709b76504da90285c849e94bf
parentda604e8646f553a4a2c7613491112b0c9b3ec400
arm64: ftrace: modify a stack frame in a safe way

Function graph tracer modifies a return address (LR) in a stack frame by
calling ftrace_prepare_return() in a traced function's function prologue.
The current code does this modification before preserving an original
address at ftrace_push_return_trace() and there is always a small window
of inconsistency when an interrupt occurs.

This doesn't matter, as far as an interrupt stack is introduced, because
stack tracer won't be invoked in an interrupt context. But it would be
better to proactively minimize such a window by moving the LR modification
after ftrace_push_return_trace().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 79fdee9b6355c9720f14717e1ad66af51bb331b5)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
arch/arm64/kernel/ftrace.c