Skip to content

Commit 9489cc8

Browse files
committed
arm: Prevent hotplug rwsem recursion
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
1 parent c23a465 commit 9489cc8

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎arch/arm/kernel/patch.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,5 @@ void __kprobes patch_text(void *addr, unsigned int insn)
124124
.insn = insn,
125125
};
126126

127-
stop_machine(patch_text_stop_machine, &patch, NULL);
127+
stop_machine_cpuslocked(patch_text_stop_machine, &patch, NULL);
128128
}

‎arch/arm/probes/kprobes/core.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ void __kprobes kprobes_remove_breakpoint(void *addr, unsigned int insn)
182182
.addr = addr,
183183
.insn = insn,
184184
};
185-
stop_machine(__kprobes_remove_breakpoint, &p, cpu_online_mask);
185+
stop_machine_cpuslocked(__kprobes_remove_breakpoint, &p,
186+
cpu_online_mask);
186187
}
187188

188189
void __kprobes arch_disarm_kprobe(struct kprobe *p)

0 commit comments

Comments
 (0)