• Steven Rostedt (VMware)'s avatar
    x86/ftrace: Only have the builtin ftrace_regs_caller call direct hooks · 5da7cd11
    Steven Rostedt (VMware) authored
    If a direct hook is attached to a function that ftrace also has a function
    attached to it, then it is required that the ftrace_ops_list_func() is used
    to iterate over the registered ftrace callbacks. This will also include the
    direct ftrace_ops helper, that tells ftrace_regs_caller where to return to
    (the direct callback and not the function that called it).
    
    As this direct helper is only to handle the case of ftrace callbacks
    attached to the same function as the direct callback, the ftrace callback
    allocated trampolines (used to only call them), should never be used to
    return back to a direct callback.
    
    Only copy the portion of the ftrace_regs_caller that will return back to
    what called it, and not the portion that returns back to the direct caller.
    
    The direct ftrace_ops must then pick the ftrace_regs_caller builtin function
    as its own trampoline to ensure that it will never have one allocated for
    it (which would not include the handling of direct callbacks).
    
    Link: http://lkml.kernel.org/r/20200422162750.495903799@goodmis.org
    
    Cc: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    5da7cd11
ftrace.c 17 KB