kprobes: Inverse taking of module_mutex with kprobe_mutex
authorSteven Rostedt <srostedt@redhat.com>
Tue, 5 Jun 2012 10:28:14 +0000 (19:28 +0900)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 31 Jul 2012 14:29:55 +0000 (10:29 -0400)
commit72ef3794c5cd5f5f0e6355c24a529224c449cd14
tree3c8c4bb28009aa938c9e24b33914d11852ec4712
parent647664eaf4033501739ac1f42dd52ce8c9266ccc
kprobes: Inverse taking of module_mutex with kprobe_mutex

Currently module_mutex is taken before kprobe_mutex, but this
can cause issues when we have kprobes register ftrace, as the ftrace
mutex is taken before enabling a tracepoint, which currently takes
the module mutex.

If module_mutex is taken before kprobe_mutex, then we can not
have kprobes use the ftrace infrastructure.

There seems to be no reason that the kprobe_mutex can't be taken
before the module_mutex. Running lockdep shows that it is safe
among the kernels I've run.

Link: http://lkml.kernel.org/r/20120605102814.27845.21047.stgit@localhost.localdomain
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: "Frank Ch. Eigler" <fche@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/kprobes.c