tracing, x86: fix fixup section to return to original code
authorSteven Rostedt <srostedt@redhat.com>
Tue, 10 Feb 2009 18:07:13 +0000 (13:07 -0500)
committerSteven Rostedt <srostedt@redhat.com>
Tue, 10 Feb 2009 18:07:13 +0000 (13:07 -0500)
Impact: fix to prevent a kernel crash on fault

If for some reason the pointer to the parent function on the
stack takes a fault, the fix up code will not return back to
the original faulting code. This can lead to unpredictable
results and perhaps even a kernel panic.

A fault should not happen, but if it does, we should simply
disable the tracer, warn, and continue running the kernel.
It should not lead to a kernel crash.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
arch/x86/kernel/ftrace.c

index 1b43086b097a8489a85adcd41a3336fb0cde4f88..9d549e4fe880ea6ef39dbdd218619635945eb8ee 100644 (file)
@@ -491,13 +491,15 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
                "1: " _ASM_MOV " (%[parent_old]), %[old]\n"
                "2: " _ASM_MOV " %[return_hooker], (%[parent_replaced])\n"
                "   movl $0, %[faulted]\n"
+               "3:\n"
 
                ".section .fixup, \"ax\"\n"
-               "3: movl $1, %[faulted]\n"
+               "4: movl $1, %[faulted]\n"
+               "   jmp 3b\n"
                ".previous\n"
 
-               _ASM_EXTABLE(1b, 3b)
-               _ASM_EXTABLE(2b, 3b)
+               _ASM_EXTABLE(1b, 4b)
+               _ASM_EXTABLE(2b, 4b)
 
                : [parent_replaced] "=r" (parent), [old] "=r" (old),
                  [faulted] "=r" (faulted)
This page took 0.026772 seconds and 5 git commands to generate.