]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
x86/ftrace: Fix ORC unwinding from ftrace handlers
authorJosh Poimboeuf <jpoimboe@redhat.com>
Tue, 23 Jan 2018 04:07:46 +0000 (22:07 -0600)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 23 Jan 2018 18:24:19 +0000 (13:24 -0500)
commite2ac83d74a4d753cea88407e65136c84a0cb60b2
tree2ccc7c642996b201c6f4f6e908a05879f695ac82
parent0c5b9b5d9adbad4b60491f9ba0d2af38904bb4b9
x86/ftrace: Fix ORC unwinding from ftrace handlers

Steven Rostedt discovered that the ftrace stack tracer is broken when
it's used with the ORC unwinder.  The problem is that objtool is
instructed by the Makefile to ignore the ftrace_64.S code, so it doesn't
generate any ORC data for it.

Fix it by making the asm code objtool-friendly:

- Objtool doesn't like the fact that save_mcount_regs pushes RBP at the
  beginning, but it's never restored (directly, at least).  So just skip
  the original RBP push, which is only needed for frame pointers anyway.

- Annotate some functions as normal callable functions with
  ENTRY/ENDPROC.

- Add an empty unwind hint to return_to_handler().  The return address
  isn't on the stack, so there's nothing ORC can do there.  It will just
  punt in the unlikely case it tries to unwind from that code.

With all that fixed, remove the OBJECT_FILES_NON_STANDARD Makefile
annotation so objtool can read the file.

Link: http://lkml.kernel.org/r/20180123040746.ih4ep3tk4pbjvg7c@treble
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
arch/x86/kernel/Makefile
arch/x86/kernel/ftrace_64.S