]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: ftrace: add support for far branches to dynamic ftrace
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 6 Jun 2017 17:00:22 +0000 (17:00 +0000)
committerWill Deacon <will.deacon@arm.com>
Wed, 7 Jun 2017 10:52:02 +0000 (11:52 +0100)
commit3b5ecc7bd9fdccb4134b5e991938c485457bf26b
tree0f8906d0ba3979cd8020dd896aa6d764afb360df
parentaa77dbc4da98e19cfde4db04faeea665aa1209c5
arm64: ftrace: add support for far branches to dynamic ftrace

Currently, dynamic ftrace support in the arm64 kernel assumes that all
core kernel code is within range of ordinary branch instructions that
occur in module code, which is usually the case, but is no longer
guaranteed now that we have support for module PLTs and address space
randomization.

Since on arm64, all patching of branch instructions involves function
calls to the same entry point [ftrace_caller()], we can emit the modules
with a trampoline that has unlimited range, and patch both the trampoline
itself and the branch instruction to redirect the call via the trampoline.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
[will: minor clarification to smp_wmb() comment]
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/Kconfig
arch/arm64/Makefile
arch/arm64/include/asm/module.h
arch/arm64/kernel/Makefile
arch/arm64/kernel/ftrace-mod.S [new file with mode: 0644]
arch/arm64/kernel/ftrace.c
arch/arm64/kernel/module.c