]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Use breakpoint method to update ftrace caller
authorSteven Rostedt <srostedt@redhat.com>
Wed, 30 May 2012 17:36:38 +0000 (13:36 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 1 Jun 2012 03:12:19 +0000 (23:12 -0400)
commit46fa543d30727b3177ef3d5037206da1ac3709d4
tree0a110234b8109154a0ffbe9bc4eb0d545da85102
parent405ca044d7689e035c60320037b21f8dc7b09fb5
ftrace: Use breakpoint method to update ftrace caller

On boot up and module load, it is fine to modify the code directly,
without the use of breakpoints. This is because boot up modification
is done before SMP is initialized, thus the modification is serial,
and module load is done before the module executes.

But after that we must use a SMP safe method to modify running code.
Otherwise, if we are running the function tracer and update its
function (by starting off the stack tracer, or perf tracing)
the change of the function called by the ftrace trampoline is done
directly. If this is being executed on another CPU, that CPU may
take a GPF and crash the kernel.

The breakpoint method is used to change the nops at all the functions, but
the change of the ftrace callback handler itself was still using a
direct modification. If tracing was enabled and the function callback
was changed then another CPU could fault if it was currently calling
the original callback. This modification must use the breakpoint method
too.

Note, the direct method is still used for boot up and module load.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
arch/x86/kernel/ftrace.c