kprobes: Prohibit probing on preemption checking debug functions
Since kprobes depends on preempt disable/enable, probing on the preempt debug routines can cause recursive breakpoint bugs. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andrea Righi <righi.andrea@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/154998804911.31052.3541963527929117920.stgit@devbox Signed-off-by: Ingo Molnar <mingo@kernel.org>hifive-unleashed-5.1
parent
eeeb080bae
commit
984640ce42
|
@ -5,10 +5,11 @@
|
||||||
* DEBUG_PREEMPT variant of smp_processor_id().
|
* DEBUG_PREEMPT variant of smp_processor_id().
|
||||||
*/
|
*/
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
|
#include <linux/kprobes.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
|
|
||||||
notrace static unsigned int check_preemption_disabled(const char *what1,
|
notrace static nokprobe_inline
|
||||||
const char *what2)
|
unsigned int check_preemption_disabled(const char *what1, const char *what2)
|
||||||
{
|
{
|
||||||
int this_cpu = raw_smp_processor_id();
|
int this_cpu = raw_smp_processor_id();
|
||||||
|
|
||||||
|
@ -56,9 +57,11 @@ notrace unsigned int debug_smp_processor_id(void)
|
||||||
return check_preemption_disabled("smp_processor_id", "");
|
return check_preemption_disabled("smp_processor_id", "");
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(debug_smp_processor_id);
|
EXPORT_SYMBOL(debug_smp_processor_id);
|
||||||
|
NOKPROBE_SYMBOL(debug_smp_processor_id);
|
||||||
|
|
||||||
notrace void __this_cpu_preempt_check(const char *op)
|
notrace void __this_cpu_preempt_check(const char *op)
|
||||||
{
|
{
|
||||||
check_preemption_disabled("__this_cpu_", op);
|
check_preemption_disabled("__this_cpu_", op);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__this_cpu_preempt_check);
|
EXPORT_SYMBOL(__this_cpu_preempt_check);
|
||||||
|
NOKPROBE_SYMBOL(__this_cpu_preempt_check);
|
||||||
|
|
Loading…
Reference in New Issue