Skip to content

Commit

Permalink
arm: Prevent hotplug rwsem recursion
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Thomas Gleixner committed May 26, 2017
1 parent c23a465 commit 9489cc8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/arm/kernel/patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
3 changes: 2 additions & 1 deletion arch/arm/probes/kprobes/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9489cc8

Please sign in to comment.