• Josh Poimboeuf's avatar
    x86/ftrace: Fix ORC unwinding from ftrace handlers · e2ac83d7
    Josh Poimboeuf authored
    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@trebleReported-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    e2ac83d7
ftrace_64.S 8 KB