summaryrefslogtreecommitdiffstats
path: root/kernel/notifier.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-05-24 10:15:36 +0200
committerThomas Gleixner <tglx@linutronix.de>2017-05-26 10:10:45 +0200
commit2d1e38f56622b9bb5af85be63c1052c056f5c677 (patch)
treedd6facbb5db86ca87074ab43353f798c108cef5e /kernel/notifier.c
parentf2545b2d4ce13e068897ef60ae64dffe215f4152 (diff)
downloadlinux-stable-2d1e38f56622b9bb5af85be63c1052c056f5c677.tar.gz
linux-stable-2d1e38f56622b9bb5af85be63c1052c056f5c677.tar.bz2
linux-stable-2d1e38f56622b9bb5af85be63c1052c056f5c677.zip
kprobes: Cure hotplug lock ordering issues
Converting the cpu hotplug locking to a percpu rwsem unearthed hidden lock ordering problems. There is a wide range of locks involved in this: kprobe_mutex, jump_label_mutex, ftrace_lock, text_mutex, event_mutex, module_mutex, func_hash->regex_lock and a gazillion of lock order permutations with nested get_online_cpus() calls. Some of those permutations are potential deadlocks even with the current nesting hotplug locking scheme, but they can't be discovered by lockdep. The conversion of the hotplug locking to a percpu rwsem requires to prevent nested locking, so it's required to take the hotplug rwsem early in the call chain and establish a proper lock order. After quite some analysis and going down the wrong road severa times the following lock order has been chosen: kprobe_mutex -> cpus_rwsem -> jump_label_mutex -> text_mutex For kprobes which hook on an ftrace function trace point, it's required to drop cpus_rwsem before calling into the ftrace code to avoid a deadlock on the func_hash->regex_lock. [ Steven: Ftrace interaction fixes ] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ingo Molnar <mingo@kernel.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sebastian Siewior <bigeasy@linutronix.de> Link: http://lkml.kernel.org/r/20170524081549.104864779@linutronix.de
Diffstat (limited to 'kernel/notifier.c')
0 files changed, 0 insertions, 0 deletions