All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64: ftrace: fix interop issues with module PLTs
@ 2017-04-10 14:13 Ard Biesheuvel
  2017-04-10 14:13 ` [PATCH 1/2] arm64: ftrace: don't validate branch via PLT in ftrace_make_nop() Ard Biesheuvel
  2017-04-10 14:13 ` [PATCH 2/2] arm64: ftrace: add support for far branches to dynamic ftrace Ard Biesheuvel
  0 siblings, 2 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2017-04-10 14:13 UTC (permalink / raw)
  To: linux-arm-kernel

The arm64 ftrace code assumes that all core kernel symbols are withing the
range of an ordinary branch instruction from anywhere in the kernel, even
in modules. While this is usually the case, it may not be true when running
with KASLR enabled.

This series fixes two distinct but related issues involving ftrace under
KASLR:

- the initial sweep over all _mcount() calls in newly loaded modules
  validates those calls by comparing each to a 'bl _mcount' opcode, which
  will fail if _mcount() [which is in the core kernel] is out of range, and
  which will result in false negatives, given that those call sites will
  contain a correct branch to _mcount(), but via a PLT entry (patch #1)

- patching up those NOPs into calls to ftrace_caller() [which is the only
  ftrace branch target that we ever use on arm64, IIUC] will fail in the
  same way, and needs to be redirected via a trampoline as well (patch #2)

Ard Biesheuvel (2):
  arm64: ftrace: don't validate branch via PLT in ftrace_make_nop()
  arm64: ftrace: add support for far branches to dynamic ftrace

 arch/arm64/Kconfig              |  2 +-
 arch/arm64/Makefile             |  3 ++
 arch/arm64/include/asm/module.h |  3 ++
 arch/arm64/kernel/ftrace.c      | 42 ++++++++++++++++++--
 arch/arm64/kernel/module-plts.c | 10 +++++
 arch/arm64/lib/Makefile         |  2 +
 arch/arm64/lib/ftrace-mod.S     | 25 ++++++++++++
 7 files changed, 82 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm64/lib/ftrace-mod.S

-- 
2.9.3

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-10 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 14:13 [PATCH 0/2] arm64: ftrace: fix interop issues with module PLTs Ard Biesheuvel
2017-04-10 14:13 ` [PATCH 1/2] arm64: ftrace: don't validate branch via PLT in ftrace_make_nop() Ard Biesheuvel
2017-04-10 14:13 ` [PATCH 2/2] arm64: ftrace: add support for far branches to dynamic ftrace Ard Biesheuvel
2017-04-10 14:22   ` Ard Biesheuvel
2017-04-10 14:39     ` Steven Rostedt
2017-04-10 14:40       ` Ard Biesheuvel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.