]> git.ipfire.org Git - people/ms/linux.git/blobdiff - arch/x86/kernel/ftrace.c
Merge tag 'v5.5-rc1' into core/kprobes, to resolve conflicts
[people/ms/linux.git] / arch / x86 / kernel / ftrace.c
index 108ee96f8b6632723f122a4741d0eeef40394373..07c32d5447e48c2bb619feec9ef504ddfd31bf65 100644 (file)
@@ -606,6 +606,20 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
        if (unlikely(atomic_read(&current->tracing_graph_pause)))
                return;
 
+       /*
+        * If the return location is actually pointing directly to
+        * the start of a direct trampoline (if we trace the trampoline
+        * it will still be offset by MCOUNT_INSN_SIZE), then the
+        * return address is actually off by one word, and we
+        * need to adjust for that.
+        */
+       if (ftrace_direct_func_count) {
+               if (ftrace_find_direct_func(self_addr + MCOUNT_INSN_SIZE)) {
+                       self_addr = *parent;
+                       parent++;
+               }
+       }
+
        /*
         * Protect against fault, even if it shouldn't
         * happen. This tool is too much intrusive to