]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
s390/ftrace/jprobes: Fix conflict between jprobes and function graph tracing
authorJiri Olsa <jolsa@kernel.org>
Sun, 31 Jul 2016 12:52:53 +0000 (14:52 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Sun, 31 Jul 2016 13:28:12 +0000 (09:28 -0400)
This fixes the same issue Steven already fixed for x86
in following commit:

  237d28db036e ftrace/jprobes/x86: Fix conflict between jprobes and function graph tracing

It fixes the crash, that happens when function graph tracing
and jprobes are used simultaneously. Please refer to above
commit for details.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
arch/s390/kernel/kprobes.c

index 250f5972536a8948a916e56a4514e942e03bde4a..dd6306c51bd645cb579c20d820197874ece9ad98 100644 (file)
@@ -690,6 +690,15 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
        stack = (unsigned long) regs->gprs[15];
 
        memcpy(kcb->jprobes_stack, (void *) stack, MIN_STACK_SIZE(stack));
+
+       /*
+        * jprobes use jprobe_return() which skips the normal return
+        * path of the function, and this messes up the accounting of the
+        * function graph tracer to get messed up.
+        *
+        * Pause function graph tracing while performing the jprobe function.
+        */
+       pause_graph_tracing();
        return 1;
 }
 NOKPROBE_SYMBOL(setjmp_pre_handler);
@@ -705,6 +714,9 @@ int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
        struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
        unsigned long stack;
 
+       /* It's OK to start function graph tracing again */
+       unpause_graph_tracing();
+
        stack = (unsigned long) kcb->jprobe_saved_regs.gprs[15];
 
        /* Put the regs back */