]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Add check for NULL regs if ops has SAVE_REGS set
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Wed, 24 Jul 2013 02:06:15 +0000 (22:06 -0400)
committerSteven Rostedt <rostedt@rostedt.homelinux.com>
Wed, 24 Jul 2013 15:22:54 +0000 (11:22 -0400)
commit6d435c6a17c27a058e62b55b36d3db066e841eba
tree5997b7318d7e41cf07bc27c3a828481f745d5fab
parent2125ec76985fc4ac45d34b41b8e72edcdfc030b4
ftrace: Add check for NULL regs if ops has SAVE_REGS set

If a ftrace ops is registered with the SAVE_REGS flag set, and there's
already a ops registered to one of its functions but without the
SAVE_REGS flag, there's a small race window where the SAVE_REGS ops gets
added to the list of callbacks to call for that function before the
callback trampoline gets set to save the regs.

The problem is, the function is not currently saving regs, which opens
a small race window where the ops that is expecting regs to be passed
to it, wont. This can cause a crash if the callback were to reference
the regs, as the SAVE_REGS guarantees that regs will be set.

To fix this, we add a check in the loop case where it checks if the ops
has the SAVE_REGS flag set, and if so, it will ignore it if regs is
not set.

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