arm: Prevent hotplug rwsem recursion
authorThomas Gleixner <tglx@linutronix.de>
Wed, 24 May 2017 08:15:38 +0000 (10:15 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 26 May 2017 08:10:46 +0000 (10:10 +0200)
The text patching functions which are invoked from jump_label and kprobes
code are protected against cpu hotplug at the call sites.

Use stop_machine_cpuslocked() to avoid recursion on the cpu hotplug
rwsem. stop_machine_cpuslocked() contains a lockdep assertion to catch any
unprotected callers.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20170524081549.275871311@linutronix.de
arch/arm/kernel/patch.c
arch/arm/probes/kprobes/core.c

index 020560b2dcb78a9c6b4591148c2df5669fab0f4d..a1a34722c655a60582e39246a09a0495d4f6404d 100644 (file)
@@ -124,5 +124,5 @@ void __kprobes patch_text(void *addr, unsigned int insn)
                .insn = insn,
        };
 
-       stop_machine(patch_text_stop_machine, &patch, NULL);
+       stop_machine_cpuslocked(patch_text_stop_machine, &patch, NULL);
 }
index ad1f4e6a9e339374219d8a74ccd6bfbc01b41f17..52d1cd14fda45d961ece2d0c4d417d986a372de9 100644 (file)
@@ -182,7 +182,8 @@ void __kprobes kprobes_remove_breakpoint(void *addr, unsigned int insn)
                .addr = addr,
                .insn = insn,
        };
-       stop_machine(__kprobes_remove_breakpoint, &p, cpu_online_mask);
+       stop_machine_cpuslocked(__kprobes_remove_breakpoint, &p,
+                               cpu_online_mask);
 }
 
 void __kprobes arch_disarm_kprobe(struct kprobe *p)